【发布时间】:2023-03-18 07:20:01
【问题描述】:
您好,我想使用 requests 和 BeautifulSoup 抓取页面帖子,但收到消息 Sorry, your browser is unsupported. 我尝试使用不同的 User-Agent,但消息相同。
我的代码
import requests
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
r = requests.get(
'https://disqus.com/home/forum/bscscan/', headers=headers)
print(r.text)
# soup = BeautifulSoup(r.text,"html.parser")
# print(soup.title.string)
# x = soup.select("a")
# print(x)
【问题讨论】:
标签: python beautifulsoup python-requests