作者nomind (Take it easy)
看板Python
标题[问题] beautifulsoup 抓网站资料
时间Tue Feb 23 19:43:01 2016
想要抓的资料是
http://store.hp.com/us/en/cat/Laptops
Shop Now 所有连出去的连结
写过其他的爬虫程式,底下的方法都可以用,不知道为什麽这个网站抓不到想到的资料
homePage = requests.get("
http://store.hp.com/us/en/cat/Laptops")
homeSoup = BeautifulSoup(homePage.text.encode("utf-8"),"html.parser")
for data in homeSoup.find_all('a',{"class":"details"}):
print(data.get("href"))
麻烦大家帮忙解惑,谢谢
--
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 153.150.182.222
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1456227786.A.8E4.html
1F:→ Ziom: 把"html.parser"的参数取消就可以了耶 02/23 20:44
2F:→ Ziom: 可以改用其他像"html5lib"会比较少出问题 02/23 21:10
3F:→ nomind: 成功了! 感谢 02/23 21:19