alc/domq

Command line XML/HTML DOM Parser

v1.0.0 2016-12-07 17:43 UTC

This package is auto-updated.

Last update: 2024-04-19 01:06:56 UTC


README

Command line HTML DOM Parser

Install globaly via composer

composer global require alc/domq

# Make sure you have export PATH in your ~/bashrc
export PATH=~/.config/composer/vendor/bin:$PATH

Usage

# Query Hacker News Titles
domq https://news.ycombinator.com/ a.storylink innertext

# Query Hacker News Urls
domq https://news.ycombinator.com/ a.storylink getAttribute href

# Query Google Urls
domq https://www.google.fr/search?q=github 'h3.r a' attr href


# Query a local file
domq sitemap.xml 'sitemap loc' innertext

# Query a list of urls
domq urls=urls.txt 'h1.entry-title a' attr href

# Parse from stdin
curl -s http://blog.chemel.fr/sitemap.xml | domq stdin loc innertext

# Piping
domq http://blog.chemel.fr/sitemap.xml loc | domq urls=- loc


# Show help
domq --help