Skip to content

otobrglez/xq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xq

xq is a lightweight command-line XPath processor for HTML and XML.

Build Status

Usage

Extracting simple content from HTML with XPath:

curl -s https://news.ycombinator.com/ | ./xq "//title"
#=> Hacker News

Extracting content from XML with XPath:

curl -s http://w1.weather.gov/xml/current_obs/KBOS.xml | ./xq "//current_observation/temp_f"
# => 59.0

A bit more sophisticated XPath from standard input:

cat ./data/wiki_page.html | ./xq "//table[@class='multicol'][7]//a/@href"
#=>
#...
#/wiki/Go_(programming_language)
#...

Development

go get -u github.com/otobrglez/xq
sudo apt-get install libxml2-dev
make test

Details

  • Project was inspired by jq - Command-line JSON processor
  • Project uses gokogiri and libxml2.

License & Author

Oto Brglez - MIT License.

About

Command-line XPath processor for HTML and XML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages