【发布时间】:2020-06-05 18:21:57
【问题描述】:
我正在做一个网络抓取项目,我试图从亚马逊网站上抓取信息。在网站中,存在一个包含此类信息的无序列表
Item Weight: 17.2 pounds
Shipping Weight: 17.4 pounds (View shipping rates and policies)
ASIN: B00HC767P6
UPC: 766789717088 885720483186 052000201628
Item model number: mark-1hooi-toop842
Customer Reviews: 4.8 out of 5 stars1,352 customer ratings
Amazon Best Sellers Rank: #514 in Grocery & Gourmet Food (See Top 100 in Grocery & Gourmet Food)
#12 in Sports Drinks
列表本身没有任何类别。问题是我不想要列表中的所有信息。只有 ASIN 码。 li 标签没有任何特定的类或 ID。这是product details page的链接
在使用 selenium 之前,我使用的是 BeautifulSoup,这就是我解决问题的方式
asin = str(soup.find('bdi', {'dir': 'ltr'}).find_parent('li'))[38:].split('<')[0]
我现在改用 selenium。如何抓取信息。
【问题讨论】:
标签: python selenium web-scraping beautifulsoup