用python 的requests抓取 csdn的页面,结果返回为空,求解
问题描述:
链接为:https://blog.****.net/weixin_43335187/article/details/83348811
代码为:
import requests
import urllib3
link = 'https://blog.****.net/weixin_43335187/article/details/83348811'
urllib3.disable_warnings()
r = requests.get(link, timeout = 3, verify=False)
r.text
显示在控制台上的就是空白
用len(r.text)获取值为0。
各位老大求解。
答
f12抓包看看,特别注意
user-agent
referer
cookie
content-type
这些你的程序模拟了没有,超时是不是太小
文字编码问题
答
如果爬取的数据为空的话,你加个请求头试一试