我进不了this webpage。
当我尝试使用requests.get(url)
时,它根本没有进展,我没有得到任何HTTP错误,只是挂起,就像它在反复尝试一样。你知道吗
我试过使用session和header,但都不适合我。你知道吗
import bs4
from bs4 import BeautifulSoup as bs
import requests
url="https://www.gogoanime1.com/watch/hangyakusei-million-arthur-2nd-season/episode/episode-1"
epn=int(input("enter which episode link is it?: "))
newses=requests.Session()
newses.headers.update({'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'})
ssn=newses.get(url)
page=ssn.text
print()
soup=bs(page,'html.parser')
a=soup.find('div',{'class':'vmn-buttons'})
links=a.find_all('a')
for link in links:
print(link)
if link.text=="Download":
print("found")
dl=link['href']
break
print(dl)
bom=newses.get(dl)
print(bom.text)
我想至少有一个回应,但它整天挂在那里,我怎么能像一个真正的用户访问网页,刮它的内容?你知道吗
我没有注意到它实际上是一个文件,而不是一个要解析的网页。在下载文件时花了更多的时间。你知道吗
相关问题 更多 >
编程相关推荐