Google电子表格ImportXML错误:“无法评估xPath查询”

时间:2014-07-09 19:02:01

标签: xpath google-sheets instagram

我正在尝试在Google Spreadsheets(旧版本,而不是新版本)中创建一个ImportXML函数,将多个帐户中的Instagram关注者数量拉入电子表格。我正在使用Webstagram作为URL。 Chrome中的“检查元素”结果如下,我试图拉出“counts_followed_by”

<div class="userinfo">
<h1>thehughjackman</h1>
<h2 class="fullname-headline">Hugh Jackman</h2>
<ul class="list-inline user-489110643">
<li><span class="ui_wrapper"><span class="counts_media">315</span><span class="legend">posts</span></span></li>
<li><span class="ui_wrapper"><span class="counts_followed_by">832,918</span><span class="legend">followers</span></span></li>
<li><span class="ui_wrapper"><span class="following">3</span><span class="legend">following</span></span></li>
</ul>
</div>

我尝试了以下公式但没有成功(其中A1是Instagram句柄):

=importxml("http://web.stagram.com/n/" & A1,"//li[contains(@class='counts_followed_by')]")
=importxml("http://web.stagram.com/n/" & A1,"//li(@class='counts_followed_by')")

我得到的错误是“无法评估给出的xPath查询。请检查查询的语法:// li ...”

1 个答案:

答案 0 :(得分:0)

//li/span/span[@class='counts_followed_by']

它需要[而不是(