<p>如果您在<code>page = requests.get('https:/.........')</code>之后执行<code>print (page)</code>,您将看到您获得一个成功的<code><Response [200]></code></p>
<p>但是如果您再次快速运行它,您将得到<code><Response [429]></code></p>
<p>“HTTP 429 Too Many Requests response status code(HTTP 429 Too Many Requests response status code)表示用户在给定时间内发送了太多请求(“速率限制”)。“Source <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429" rel="nofollow noreferrer">here</a></p>
<p>另外,如果您查看html源代码,您会看到:</p>
<pre><code><h1>whoa there, pardner!</h1>
<p>we're sorry, but you appear to be a bot and we've seen too many requests
from you lately. we enforce a hard speed limit on requests that appear to come
from bots to prevent abuse.</p>
<p>if you are not a bot but are spoofing one via your browser's user agent
string: please change your user agent string to avoid seeing this message
again.</p>
<p>please wait 6 second(s) and try again.</p>
<p>as a reminder to developers, we recommend that clients make no
more than <a href="http://github.com/reddit/reddit/wiki/API">one
request every two seconds</a> to avoid seeing this message.</p>
</code></pre>
<p>要添加标题并避免使用429附加模块:</p>
^{pr2}$
<p><strong>完整代码:</strong></p>
<pre><code>import requests
from bs4 import BeautifulSoup
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"}
page = requests.get('https://www.reddit.com/r/FortNiteBR/comments/afjbbp/just_trying_to_revive_my_buddy_and_then_he_got/', headers=headers)
print (page)
soup = BeautifulSoup(page.text, 'html.parser')
source_tags = soup.find_all('source')
print(source_tags)
</code></pre>
<p><strong>输出:</strong></p>
<pre><code><Response [200]>
[<source src="https://v.redd.it/et9so1j0z6a21/HLSPlaylist.m3u8" type="application/vnd.apple.mpegURL"/>]
</code></pre>
<p>并且在等待一两秒钟后重新运行没有问题</p>