【发布时间】:2015-02-27 05:08:48
【问题描述】:
感谢关注! 我正在尝试在搜索结果中检索产品的 href。 例如这个页面:
但是,当我缩小到产品图像类时,检索到的 href 是图像链接.... 任何人都可以解决这个问题吗?提前致谢!
url = 'http://www.homedepot.com/b/Husky/N-5yc1vZrd/Ntk-All/Ntt-chest%2Band%2Bcabinet?Ntx=mode+matchall&NCNI-5'
content = urllib2.urlopen(url).read()
content = preprocess_yelp_page(content)
soup = BeautifulSoup(content)
content = soup.findAll('div',{'class':'content dynamic'})
draft = str(content)
soup = BeautifulSoup(draft)
items = soup.findAll('div',{'class':'cell_section1'})
draft = str(items)
soup = BeautifulSoup(draft)
content = soup.findAll('div',{'class':'product-image'})
draft = str(content)
soup = BeautifulSoup(draft)
【问题讨论】:
标签: python html web-scraping beautifulsoup html-parsing