[問題] beautifulsoup 抓網站資料

作者: nomind (Take it easy)   2016-02-23 19:43:01
想要抓的資料是 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"))
麻煩大家幫忙解惑,謝謝
作者: Ziom (Oquainogen)   2016-02-23 20:44:00
把"html.parser"的參數取消就可以了耶可以改用其他像"html5lib"會比較少出問題
作者: nomind (Take it easy)   2016-02-23 21:19:00
成功了! 感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com