2022-02-18 09:01:57 -05:00
|
|
|
# xidel
|
|
|
|
|
|
|
|
> Download and extract data from HTML/XML pages as well as JSON APIs.
|
|
|
|
> More information: <https://www.videlibri.de/xidel.html>.
|
|
|
|
|
|
|
|
- Print all URLs found by a Google search:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://www.google.com/search?q=test}} {{[-e|--extract]}} "//a/extract(@href, 'url[?]q=([^&]+)&', 1)[. != '']"`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Print the title of all pages found by a Google search and download them:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://www.google.com/search?q=test}} {{[-f|--follow]}} "{{//a/extract(@href, 'url[?]q=([^&]+)&', 1)[. != '']}}" {{[-e|--extract]}} {{//title}} --download {{'{$host}/'}}`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Follow all links on a page and print the titles, with XPath:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://example.org}} {{[-f|--follow]}} {{//a}} {{[-e|--extract]}} {{//title}}`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Follow all links on a page and print the titles, with CSS selectors:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://example.org}} {{[-f|--follow]}} "{{css('a')}}" --css {{title}}`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Follow all links on a page and print the titles, with pattern matching:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://example.org}} {{[-f|--follow]}} "{{<a>{.}</a>*}}" {{[-e|--extract]}} "{{<title>{.}</title>}}"`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Read the pattern from example.xml (which will also check if the element containing "ood" is there, and fail otherwise):
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{path/to/example.xml}} {{[-e|--extract]}} "{{<x><foo>ood</foo><bar>{.}</bar></x>}}"`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Print all newest Stack Overflow questions with title and URL using pattern matching on their RSS feed:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{http://stackoverflow.com/feeds}} {{[-e|--extract]}} "{{<entry><title>{title:=.}</title><link>{uri:=@href}</link></entry>+}}"`
|
2022-02-18 09:01:57 -05:00
|
|
|
|
|
|
|
- Check for unread Reddit mail, Webscraping, combining CSS, XPath, JSONiq, and automatically form evaluation:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`xidel {{https://reddit.com}} {{[-f|--follow]}} "{{form(css('form.login-form')[1], {'user': '$your_username', 'passwd': '$your_password'})}}" {{[-e|--extract]}} "{{css('#mail')/@title}}"`
|