【发布时间】:2021-12-15 08:43:30
【问题描述】:
我正在尝试使用 bs4 和请求从网站获取一些信息。
我正在尝试访问特定的 div:
<div id="jive-comment-tabs" class="j-comment-wrapper" xmlns="http://www.w3.org/1999/html"> ..... </div>
但是当我使用以下代码时:
import requests
from bs4 import BeautifulSoup
URL = "https://www.element14.com/community/community/design-challenges/in-the-air-design-challenge/blog/2014/10/26/firecracker-analyzer-index"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "lxml")
print(soup.find('div', {'class': 'j-comment-wrapper'}))
我得到 None 结果,我知道它在网页上。我尝试了互联网上的大多数解决方案,但没有一个对我有帮助。有什么想法吗?
【问题讨论】:
-
您的代码对我有用。你检查响应状态码了吗?
标签: python-3.x web-scraping beautifulsoup python-requests