当我试图打印产品的价格时,输出屏幕是空白的阿姆扎恩(顺便说一句,它与flipkart合作过)
url='https://www.amazon.in/Lenovo-K8-Plus-Venom-Storage/dp/B079JC4K7C/ref=sr_1_1?s=electronics&ie=UTF8&qid=1545233164&sr=1-1&keywords=lenovo%2Bk8%2Bplus&th=1'
r=requests.get(url)
soup=BeautifulSoup(r.content,"html.parser")
store=soup.find_all("div",{"class":"a-section a-spacing-small"})
for item in store:
price = item.find_all("span",{"id":"priceblock_ourprice"})
print(price.get_text())
预计产量:8098(按现行价格)
实际:黑屏
价格表被亚马逊屏蔽了。如果您查看
soup
,您会发现价格没有列出,而是显示以下信息:我建议您使用官方API获取奖品。如果你没有这个选择,你将不得不自动化你的浏览器。这可以通过selenium实现。你知道吗
相关问题 更多 >
编程相关推荐