爬取百度網盤資源報user is not authorized, hitcode:119

爬取百度網盤資源報user is not authorized, hitcode:119

1、總結

一句話總結:

多是百度網盤禁止非客戶端環境下載大文件,因此將請求頭改成客戶端:'User-Agent': 'netdisk;8.2.0;android-android;4.4.4'

不知道何時開始,百度網盤禁止非客戶端環境下載大文件。html

因此爬取內容時,將User-Agent修改android

原本你請求頭中的User-Agent是這麼寫的spa

'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

如今修改成.net

'User-Agent': 'netdisk;8.2.0;android-android;4.4.4'

再試試說不定就能夠了。code

 

 

 

2、爬取百度網盤資源報user is not authorized, hitcode:119

轉自或參考:爬取百度網盤資源報user is not authorized, hitcode:119
https://blog.csdn.net/wuhaibin12/article/details/85007379htm

 

對於小於100M的文件,在抓包獲得下載鏈接後能夠直接開始爬取內容。blog

對於大於100M的文件,爬取時會獲得user is not authorized, hitcode:119的返回值。資源

不知道何時開始,百度網盤禁止非客戶端環境下載大文件。it

因此爬取內容時,將User-Agent修改class

原本你請求頭中的User-Agent是這麼寫的

'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

如今修改成

'User-Agent': 'netdisk;8.2.0;android-android;4.4.4'

再試試說不定就能夠了。

相關文章
相關標籤/搜索