【发布时间】:2018-02-10 15:15:42
【问题描述】:
我尝试运行以下 python 代码:
import requests
headers={'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36'}
url="https://search.bilibili.com/all?keyword=Steins;Gate0"
try:
r=requests.get(url=url,headers=headers)
r.encoding='utf-8'
if(r.status_code==200):
print(r.text)
except:
print("This is the selection of Steins Gate")
我是网络爬虫的初学者。这是一个爬虫蜘蛛在python上通过请求写的,但是我无法获取完整页面,我认为这是异步页面加载的问题(也许网站有其他策略) 所以问题是如何获取整页。
【问题讨论】:
标签: python python-3.x web-crawler python-requests headless-browser