【问题标题】:Google IMPORTXML scraping Shopee price to google sheet谷歌 IMPORTXML 将 Shopee 价格抓取到谷歌表
【发布时间】:2021-08-07 13:00:48
【问题描述】:

我正在尝试从此 URL 中提取价格: https://shopee.co.th/product-i.389528981.8764867001

所以我使用这条路径:

=importXML"https://shopee.co.th/product-i.389528981.8764867001","[//div[contains@class,'_3e_UQT')]")

但是还是不行,求大神指教。

提前谢谢你

【问题讨论】:

    标签: xml web-scraping google-sheets


    【解决方案1】:

    Google 表格不支持对 JavaScript 控制的元素进行网络抓取。您可以通过禁用给定站点的 JS 来轻松检查它,并且只能抓取剩余可见的内容。不幸的是,在你的情况下,这没什么:

    【讨论】:

    • 你是对的!有时我们可以在源代码中的脚本(例如 yahoo)中找到 url 或 json,这里不是这种情况!
    • @MikeSteelson 去吧 - 重新打开
    • 这是一个挑战...... json 通常包含在这里 xhr.open("GET",origin+"/api/v4/pages/is_short_url/?path="+pathname.replace("/","")) 与 origin = https://shopee.co.th 和 pathname = /product-i.389528981.8764867001 ,但如果你直接调用这个 url 答案是一个空的 json;我稍后会尝试添加xhr.setRequestHeader
    • 没办法,我用 ajax 和 XMLHttpRequest 做了一些测试,但是 json 仍然是空的!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    相关资源
    最近更新 更多