XPath下一页导航

时间:2015-09-23 15:37:52

标签: xpath

我使用Chrome数据挖掘器,到目前为止,无法从我的查询中提取数据:http://www.allinlondon.co.uk/restaurants.php?type=name&rest=gluten+free

如何为此网站编写Next Element Xpath代码?我尝试了所有可能的网络资源,没有任何效果。

提前致谢!

1 个答案:

答案 0 :(得分:1)

您可以查找a标记//a,其descendant::text()以&#34开头;下一页"然后获取该href元素的a属性。

% xpquery -p HTML '//a[starts-with(descendant::text(), "Next")]/@href' 'http://www.allinlondon.co.uk/restaurants.php?type=name&rest=gluten+free'       
 href="http://www.allinlondon.co.uk/restaurants.php?type=name&tube=0&rest=glutenfree&region=0&cuisine=0&start=30&ordering=&expand="