Skip to content

Instantly share code, notes, and snippets.

@neilmcguigan
Created April 16, 2024 03:38
Show Gist options
  • Save neilmcguigan/7d516e072f8901d439938bea7cbaaa83 to your computer and use it in GitHub Desktop.
Save neilmcguigan/7d516e072f8901d439938bea7cbaaa83 to your computer and use it in GitHub Desktop.
xidel scraping
# get the current url (watch your quoting):
xidel https://example.com --extract '$url'
# output JSON lines:
xidel --printed-json-format=compact https://example.com --extract '{"title"://title, "url": $url}'
# for a list of items, with pagination: follow item, extract data, paginate:
xidel https://example.com [ --follow //a[@class='item'] --extract //*[@class='price'] ] --follow //a[@class='next-page']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment