importxml google docs - 导入内部错误

时间:2015-08-13 14:56:37

标签: xml xpath import google-sheets

我正试图密切关注顶级联盟梦幻足球网站中的游戏周刊分数。

我尝试从http://fantasy.premierleague.com/entry/79000/event-history/1/

导入xml的网页

XPATH(使用Chrome中的XPATH HELPER扩展程序)

  

html [@ class ='js flexbox canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths'] / body / div [@ id ='body'] / div [@ class ='ismWrapper'] / div [@ class ='ismContent clearfix'] / div [@ id ='ism'] / section [@ class ='ismSecondary'] / div [@ class ='ismMod'] [1] / div [@ class ='ismModBody'] / dl [@class ='ismDefList ismRHSDefList'] / dd [1]

结果应为38.我从以下

获得“导入内部错误”
  

= IMPORTXML(“http://fantasy.premierleague.com/entry/79000/event-history/1/”,“// html [@ class ='js flexbox canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths'] / body / div [@ id ='body'] / div [@ class ='ismWrapper'] / div [@ class ='ismContent clearfix '] /格[@ ID =' 主义 '] /部分[@类=' ismSecondary '] /格[@类=' ismMod '] [1] /格[@类=' ismModBody'] / dl的[@class ='ismDefList ismRHSDefList'] / dd [1]]“)

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你的xpath太复杂了 - 有了这些,特别是在谷歌文档中,实际上更好的是稍微复杂一些,但更模糊但是从通配符开始然后指定最接近的唯一类,然后在需要时将其缩小

试试这个:

=IMPORTXML("http://fantasy.premierleague.com/entry/79000/event-history/1/","//*[@class='ismModBody']/*/dd[1]")