Web使用BeautifulSoup抓取隐藏的元素

时间:2018-12-07 15:54:30

标签: python-3.x web-scraping beautifulsoup

我正在尝试使用BeautifulSoup在网站上抓取隐藏元素(日期)。但是,我一直得到None类型或以下输出:-。任何帮助将不胜感激!

 **This is how the relevant part looks on the website:**

 <div class="by C C4">
      <span class="hidden-lists">Oct 8, 2018</span>


 **This is the relevant portion of my code:**

 target_3 = page_soup.find("span", attrs={"class": "hidden-lists"})
 print(target_3)

1 个答案:

答案 0 :(得分:0)

这里:

target_3.text.strip()
print(target_3)

我不确定这是否可以完全解决您的问题,但请尝试一下。