小编k m*_*ish的帖子

如何在抓取请求时绕过 Google Recaptcha

请求 URL 的 Python 代码:

agent = {"User-Agent":'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'} #using agent to solve the blocking issue
response = requests.get('https://www.naukri.com/jobs-in-andhra-pradesh', headers=agent)
#making the request to the link
Run Code Online (Sandbox Code Playgroud)

打印 html 时的输出:

<!DOCTYPE html>

<html>
  <head>
    <title>Naukri reCAPTCHA</title> #the title in the actual title of the URL that I am requested for
    <meta name="robots" content="noindex, nofollow">
        <link rel="stylesheet" href="https://static.naukimg.com/s/4/101/c/common_v62.min.css" />      
        <script src="https://www.google.com/recaptcha/api.js" async defer></script>   
    </head>
</html>
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup web-scraping python-requests

5
推荐指数
1
解决办法
1万
查看次数