从电子商务网站Python刮擦数据
我设法从eBay刮擦数据,并且正在尝试从另一个站点进行相同的操作,但是HTML代码的结构略有不同,因此我无法刮擦数据。 我正在尝试以下代码,
k = requests.get('https://www.skroutz.gr/plus-deals').text
soup=BeautifulSoup(k,'html.parser')
productlist = soup.find_all("li",{"class":"cf card\nadd-to-cart-cta"})
print(productlist)
我认为您可以看到的问题是因为在课堂上有一个折断。
我也试图从同一页面上刮擦标题,但我也无法。
这是链接:skroutz.gr/plus-deals
谢谢
I manage to scrape data from ebay and I am trying to do the same from another site but the structure of html code is slightly different and due to that I am not able to scrape the data.
I am trying with the following code
k = requests.get('https://www.skroutz.gr/plus-deals').text
soup=BeautifulSoup(k,'html.parser')
productlist = soup.find_all("li",{"class":"cf card\nadd-to-cart-cta"})
print(productlist)
I think the problem as you can see is because with in the class there is a line break.
Also I tried to scrape the title from the same page but I was not able as well.
This is the link : skroutz.gr/plus-deals
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不必指定元素的所有类,只需将它们捡起来指定一个类,例如
cf
,请尝试以下操作:You don't have to specify all the classes of the element, you can just simply pick them up specifying one class like
cf
, try this: