[英]Googlesheets function - IMPORTXML Xpath difficulties for column text within Yahoo Finance
Creating a ticker scanner tool on googlesheets with mainly google finance and yahoo finance.在 googlesheets 上创建一个股票扫描仪工具,主要是 google Finance 和 yahoo Finance。 No difficulties with index(importhtml()) and other functions however I can't manage to find the correct Xpath when using importxml.
index(importhtml()) 和其他功能没有困难,但是在使用 importxml 时我无法找到正确的 Xpath。 I have no background in html or Xpath so I am a novice but I understand the basics behind it from troubleshooting recently.
我没有 html 或 Xpath 的背景,所以我是新手,但我最近从故障排除中了解了它背后的基础知识。
URL: https://au.finance.yahoo.com/quote/FMG.AX?p=FMG.AX URL: https://au.finance.yahoo.com/quote/FMG.AX?p=FMG.AX
I am trying to pull in text information about SECTOR, INDUSTRY and the DESCRIPTION which is on the right hand side (about half way down the page).我正在尝试提取右侧的有关部门、行业和描述的文本信息(大约在页面的一半处)。 It seems to be within a column which may be causing me trouble.
它似乎在可能给我带来麻烦的列中。 Using Chrome inspect to retrieve XML but also tried several chrome extensions which didn't work either.
使用 Chrome 检查来检索 XML 但也尝试了几个也不起作用的 chrome 扩展。
This is what I got when copying Xpath (short and long versions)这是我在复制 Xpath(短版和长版)时得到的
Sectors: //*[@id="Col2-11-QuoteModule-Proxy"]/div/div/div/div/p[2]部门://*[@id="Col2-11-QuoteModule-Proxy"]/div/div/div/div/p[2]
Business Summary: /html/body/div[1]/div/div/div[1]/div/div[3]/div[2]/div/div/div/div/div/div[12]/div/div/div/div/div/p业务总结:/html/body/div[1]/div/div/div[1]/div/div[3]/div[2]/div/div/div/div/div/div[12]/div /div/div/div/div/p
Also tried shortening the /div with //p but doesn't work anyway.还尝试使用//p 缩短/div,但无论如何都不起作用。
I played around and used //body/div//div/p which retrieved news data from the middle of the page.我到处玩并使用 //body/div//div/p 从页面中间检索新闻数据。
Wondering if someone could help me adjust or explain what I am doing wrong and point me in the right direct.想知道是否有人可以帮助我调整或解释我做错了什么,并指出我正确的方向。 Any help would be greatly appreciated.
任何帮助将不胜感激。 Thank you so much to anyone that takes a look!
非常感谢任何看的人!
Apparently, the data you are trying to pull is controlled by JavaScript which means you won't be able to fetch it using IMPORTXML.显然,您尝试提取的数据由 JavaScript 控制,这意味着您将无法使用 IMPORTXML 获取它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.