0

如何a.next使用 xidel 递归地跟踪链接(即:分页)?

我有以下有效的代码,但它只获取第一页。是否可以跟踪a.next分页页脚中的链接,直到它不再存在?

xidel 'https://www.yellowpages.com/search?search_terms=mexican+food&geo_location_terms=95032' --xquery \
  'for $b in //div[contains(@class, "info-primary")]
    let $link := $b//a[contains(@class, "track-visit-website")]/@href/string()
    let $name := $b//a[contains(@class, "business-name")]/span/string()
    where $link and $name
    return <business>
      <name>{$name}</name>
      <link>{$link}</link>
    </business>' --output-format xml | xq . | jq .xml
4

0 回答 0