用于抓取数据的 XPath 查询
XPath queries to scrape data
我正在使用 Chrome 中的 Copy XPath 创建我的查询。它工作得很好,但不适用于这个问题。
这里 is the site 我从这里抓取数据。
一个有效的查询(table 1 中“Senaste NAV-kurs”旁边的数字)
=IMPORTXML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId="&1085603;"//*[@id='fund-summary-wrap']/div[1]/dl[2]/dd/text()" )
但是当我从 table 复制标题为“AVKASTNING”的 XPath 时,我没有得到任何数据,请帮忙
=IMPORTXML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId="&1085603;"//*[@id='ctl00_FourColumnWidthContent_ThreeColumnsContent_MainAndSecondColumnContent_fundInfo_fundPerformance_tableFund']/tbody/tr[4]/td[2]/span" )
如果你愿意换个方式试试,下面会得到"AVKASTNING"table.
=IMPORTHTML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId=1085603","table",7)
如果您想要 table 中的特定值,请使用索引。下面的例子获取第二行第二列的值:
=index(IMPORTHTML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId=1085603","table",7),2,2)
我正在使用 Chrome 中的 Copy XPath 创建我的查询。它工作得很好,但不适用于这个问题。
这里 is the site 我从这里抓取数据。
一个有效的查询(table 1 中“Senaste NAV-kurs”旁边的数字)
=IMPORTXML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId="&1085603;"//*[@id='fund-summary-wrap']/div[1]/dl[2]/dd/text()" )
但是当我从 table 复制标题为“AVKASTNING”的 XPath 时,我没有得到任何数据,请帮忙
=IMPORTXML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId="&1085603;"//*[@id='ctl00_FourColumnWidthContent_ThreeColumnsContent_MainAndSecondColumnContent_fundInfo_fundPerformance_tableFund']/tbody/tr[4]/td[2]/span" )
如果你愿意换个方式试试,下面会得到"AVKASTNING"table.
=IMPORTHTML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId=1085603","table",7)
如果您想要 table 中的特定值,请使用索引。下面的例子获取第二行第二列的值:
=index(IMPORTHTML("http://www.di.se/di-fonder/fonddetaljer/?InstrumentId=1085603","table",7),2,2)