蟒蛇网页抓取.网站不显示仅几个脚本标记.尝试使用硒驱动程序浏览器打开



我试图从这个网站上拉价格。 我首先尝试使用美丽的汤,然后使用硒网络驱动程序浏览器打开页面,但得到此响应。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="about:blank">
</head>
<body>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/j.js"></script>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/f.js"></script>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint/script/kpf.js?url=/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint&token=9d98d39f-e497-2d15-7332-7e21738bd6e2"></script>
</body>
</html>

这是我的蟒蛇代码。

from selenium import webdriver
dove_coles_url = "https://shop.coles.com.au/a/churchill-centre/product/dove-antiperspirant-deodorant-invisible-dry"
PATH = "C:\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.delete_all_cookies()
driver.get(dove_coles_url)

提前谢谢。

使用浏览器控制台,在"网络"选项卡中,您可以看到正在发出此请求:

https://shop.coles.com.au/search/resources/store/20509/productview/bySeoUrlKeyword/dove-antiperspirant-deodorant-invisible-dry?catalogId=17056

打开它,您将看到它以 JSON 格式包含此产品的所有数据。

最新更新