簡體   English   中英

如何在 Python 中繞過 BeautifulSoup 的 Recaptcha?

[英]How to bypass Recaptcha for BeautifulSoup in Python?

我希望使用BeautifulSoup ( BS4 ) 從https://www.example.com獲取數據

req = requests.get('https://www.example.com/')
soup = BeautifulSoup(req.text, "lxml")
cDF = soup.find('div',attrs={"id" : "nav-tabContent"}).find(
    'table',attrs={"id" : "main_table_countries_today"}).find_all('tr')

我發現一個錯誤

cDF = soup.find('div',attrs={"id" : "nav-tabContent"}).find(
AttributeError: 'NoneType' object has no attribute 'find'

我在調試soup的時候,發現其實是顯示被Cloudflarerecaptcha頁面卡住了。

我檢查了其他類似的問題,但發現大多數問題的答案為零。 已經回答了一個(2 個回復)以檢查與我的查詢無關的特定機器人測試。 因此,我認為這個問題一定不能標記為重復問題。

請告訴我如何繞過 recaptcha 獲取分析數據。 順便說一下,我在 ubuntu 的 google chrome 中使用 privacypass。謝謝。

嘗試更改用戶代理 header。例如,它可以與 curl 一起使用,因此沒有任何高級保護。

我希望使用BeautifulSoup ( BS4 ) 從https://www.example.com獲取數據

req = requests.get('https://www.example.com/')
soup = BeautifulSoup(req.text, "lxml")
cDF = soup.find('div',attrs={"id" : "nav-tabContent"}).find(
    'table',attrs={"id" : "main_table_countries_today"}).find_all('tr')

我發現一個錯誤

cDF = soup.find('div',attrs={"id" : "nav-tabContent"}).find(
AttributeError: 'NoneType' object has no attribute 'find'

當我調試soup時,我發現它實際上顯示它被Cloudflarerecaptcha頁面卡住了。

我檢查了其他類似的問題,而我發現大多數問題的答案都是零。 已回答一個(2 個答復)以檢查與我的查詢無關的特定機器人測試。 因此,我認為這個問題不能被標記為重復問題。

請告訴我如何繞過 recaptcha 獲取分析數據。 順便說一句,我在 ubuntu 的谷歌瀏覽器中使用了隱私密碼。 謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM