X-Ray Paginate filter by text

℡╲_俬逩灬. 提交于 2019-12-11 17:49:21

问题


I am using x-ray to scrap a webpage with pagination. Here are some HTML

<td align="center" style="font-size: 11pt;">
  <div class="paginate" style="font-size: 11pt;">
    <span class="disabled">Previous</span>
    <span class="current">1</span>
    <a href="link2.html">2</a>
    <a href="link2.html">Next</a>
  </div>
</td>

I would like to scrap by the Next button. But the web page example is scraped by it's class name.

x('https://blog.ycombinator.com/', '.post', [{
  title: 'h1 a',
  link: '.article-title@href'
}])
  .paginate('.nav-previous a@href')

I would like to know how can I paginate by choosing the link in the Next button?

Thanks in advance.


回答1:


Filter by text

.paginate('.paginate a:contains(Next)@href')



回答2:


mybe this can help you write this in paginate

.paginate('.paginate > li.current + a > a@href')
or
.paginate('.paginate > li.current > a@href')

thanx



来源:https://stackoverflow.com/questions/44885793/x-ray-paginate-filter-by-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!