擅长:python、mysql、java
<p>您正在处理的问题是关于<em>网页抓取</em>。在您的情况下,由于您的标题声明缺少正确的用户代理定义,您的网页会被阻塞</p>
<p>要使其正常工作,您需要包括如下所示的用户代理声明:</p>
<pre class="lang-py prettyprint-override"><code>headers={'user-agent':'Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522+ (KHTML, like Gecko) Safari/419.3',}
</code></pre>
<p>在这里,您可以更深入地探讨编写优秀web scraper的问题:
<a href="https://towardsdatascience.com/5-strategies-to-write-unblock-able-web-scrapers-in-python-5e40c147bdaf" rel="nofollow noreferrer">https://towardsdatascience.com/5-strategies-to-write-unblock-able-web-scrapers-in-python-5e40c147bdaf</a></p>
<p>可在此处找到适当的用户代理列表:
<a href="https://webscraping.com/blog/User-agents/" rel="nofollow noreferrer">https://webscraping.com/blog/User-agents/</a></p>
<p>希望你能解决你的问题</p>