htmlq

Extract HTML content using CSS selectors from the command line.

brewmacoslinux
Try with needOr install directly
Source

About

Uses CSS selectors to extract bits content from HTML files

Commands

htmlq

Examples

get all links from a webpage$ curl https://example.com | htmlq 'a' --attr href
extract text from specific HTML elements$ htmlq '.article-title' index.html
scrape multiple elements and filter results$ cat page.html | htmlq 'div.product' --text
find attribute values in HTML tags$ htmlq 'img' --attr src,alt file.html
parse nested elements with complex selectors$ htmlq 'section > article:nth-child(2) p' document.html