Xpath Google Sheets的html类计数图标

使用Google表格对Xpath相对较新。我正在尝试从电影网站上获得分数,该网站的得分是五颗星,其中有五角星使用的图像,因此我需要从下面的HTML计数class-star-full类

<span class="rating "><i class="icon-star-full"></i> <i class="icon-star-full"></i> <i class="icon-star-full"></i> <i class="icon-star-full"></i> <i class="icon-star"></i></span> 

在Google表格中,除icon-star-full之外,count函数对于我尝试的每个课程似乎都工作正常。例如count(// [@ class ='rating'])正常工作,我得到了每个名为rating的类的计数。但是count(// [@ class ='icon-star-full'])在每页上返回0。例如,在上面的HTML中,我的计数应该为3,但为0。

我应该对图标进行计数吗?

randy09 回答:Xpath Google Sheets的html类计数图标

尝试:

=COUNTA(IFERROR(QUERY(ARRAY_CONSTRAIN(IMPORTDATA(A1),1000,1),"where Col1 contains 'icon-star-full'")))&"/5"

其中 A1 是您的网址

0

本文链接:https://www.f2er.com/3044036.html

大家都在问