【发布时间】:2016-11-20 20:50:35
【问题描述】:
我正在编写一个用于从该网页上抓取视频标题的脚本 "https://www.google.com.eg/trends/hotvideos" 但问题是标题隐藏在 html 源页面上,但如果我使用检查器查找它,我可以看到它
这是我的代码,它与它配合得很好 ("class":"wrap") 但是当我将它与隐藏的“class”:“hotvideos-single-trend-title-container”一起使用时,它并没有给我任何输出
#import urllib2
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen('https://www.google.com.eg/trends/hotvideos').read()
soup = BeautifulSoup(html)
print (soup.findAll('div',{"class":"hotvideos-single-trend-title-container"}))
#wrap
【问题讨论】:
标签: python python-2.7 python-3.x web-scraping beautifulsoup