【发布时间】:2022-01-11 02:19:14
【问题描述】:
我正在使用 BeautifulSoup 抓取一个网站,但 html 的输出与通过网络浏览器在页面源上显示的不匹配。缺少一些标签。以下是我的代码:
URL = '<url>'
response = requests.get(URL, headers = header)
html_doc = BeautifulSoup(response, 'html.parser')
content = html_doc.find('div', attrs={'class':'content-wrapper'})
我不确定发生了什么,但它可能与事件监听器有关。我在页面源的这个标签之后找到它。
【问题讨论】:
-
可以分享你要抓取的网页的url吗?
标签: python html web-scraping beautifulsoup