豆瓣这个页面的反爬用了什么黑科技
資深大佬 : wjfz 6
目前的情况:
1 、在终端里直接 curl 不加任何参数是可以获取到的
curl https://www.douban.com/doubanapp/h5/book/2567698/desc
2 、Python requests 库获取不到
3 、PHP curl 带上从 chrome 复制的全套 header 也获取不到。
疑问的点
1 、终端里不带参数为什么能请求到
2 、用代码的方式不管怎样都请求不到,即使带了 chrome 能正常访问的全套 header
import requests import os os.system('curl https://www.douban.com/doubanapp/h5/book/2567698/desc') url = 'https://www.douban.com/doubanapp/h5/book/2567698/desc' strhtml = requests.get(url) print(strhtml.text)
大佬有話說 (10)