【问题标题】:Capture element using ImportXML with XPath使用 ImportXML 和 XPath 捕获元素
【发布时间】:2017-12-20 14:25:27
【问题描述】:

我正在尝试通过 Google 表格从页面获取以下信息,例如 here

我必须检索这两项以红色圈出的项目,如所附的抓取数据兴趣截图所示。

我试过这个,但它不起作用(A1中有链接,B1有公式):

=IMPORTXML(A1;"/html/body/div[1]/div[2]/div[1]/span[1])

=IMPORTXML(A1;"/html/body/div[1]/div[3]/table/tbody/tr[1]/td[3])

有没有人可以帮帮我?

【问题讨论】:

  • 如果页面源代码中没有内容,则IMPORTXML无法读取。

标签: html xpath web-scraping google-sheets


【解决方案1】:

他们的 robots.txt 文件:

User-Agent: *  
Disallow: /

The "User-agent: *" means this section applies to all robots. The "Disallow: /" tells the robot that it should not visit any pages on the site..

可以使用 Excel,从 Web 提取所需的信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多