Python requests爬取今日头条,为什么获取不了网页内容
headers={'user-agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeG...
headers = {
'user - agent': 'Mozilla / 5.0(Windows NT 10.0; WOW64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 53.0.2785.104Safari / 537.36Core / 1.53.4882.400QQBrowser / 9.7.13059.400'
}
response = requests.get('http://toutiao.com/group/6552087122092753412', headers = headers)
print(response.text)
-------------------------------------------------------------------------
得到的结果:
---------------------------------------------------------------------------
E:\Python_Pro\Spider\venv\Scripts\python.exe E:/Python_Pro/toutiao/jiepai.py
<html><head></head><body></body></html>
进程已结束,退出代码0
-----------------------------------------------------------------
求大神解答,是因为这个网页有反爬虫机制吗?我需要怎么破解。。萌新求大神指导 展开
'user - agent': 'Mozilla / 5.0(Windows NT 10.0; WOW64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 53.0.2785.104Safari / 537.36Core / 1.53.4882.400QQBrowser / 9.7.13059.400'
}
response = requests.get('http://toutiao.com/group/6552087122092753412', headers = headers)
print(response.text)
-------------------------------------------------------------------------
得到的结果:
---------------------------------------------------------------------------
E:\Python_Pro\Spider\venv\Scripts\python.exe E:/Python_Pro/toutiao/jiepai.py
<html><head></head><body></body></html>
进程已结束,退出代码0
-----------------------------------------------------------------
求大神解答,是因为这个网页有反爬虫机制吗?我需要怎么破解。。萌新求大神指导 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询