作者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://www.ptt.cc/bbs/Python/M.1456227786.A.8E4.html
→ Ziom: 把"html.parser"的參數取消就可以了耶 02/23 20:44
→ Ziom: 可以改用其他像"html5lib"會比較少出問題 02/23 21:10
→ nomind: 成功了! 感謝 02/23 21:19