npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hquery

v1.0.0

Published

jquery for html in command line

Downloads

19

Readme

hquery Build Status

Parse HTML with jQuery and Lodash in your commnd line.

Getting Started

Install : npm install hquery -g

Usage

Usage: hquery [options] [commands]

Options:
 -p if you use hquery in pipe
 -s if you want parse html string
 -r the javascript code you want to run
 -f the javascript file you want to run
 -l if you want to use plugin, available plugins: table2csv, attr, csv
 -a if you use a plugin, use -a to add arg for the plugin

Examples

curl -s https://github.com | hquery -p -r '$("title").html()'
hquery -s '<div id="aa"><p>haha<p></div>' -r '$("#aa").html()'
hquery -r '_.range(1, 10)'
curl -s https://github.com | hquery -p -f a.js
curl -s http://news.mtime.com/2014/01/27/1523487-7.html | hquery -p -l table2csv -a '#newscont table'
curl -s http://news.mtime.com/2014/01/27/1523487-7.html | hquery -p -l attr -a 'body a|href'
curl -s https://news.ycombinator.com/ | hquery -p -l csv -a 'table .title a|text:title,attr:href'
curl -s https://news.ycombinator.com/ | hquery -p -l json -a 'table .title a|text:title,attr:href'
curl -s http://hquery-test.surge.sh/index.html | hquery -p -l json2 -a '.list li;{"title": "a|text", "href":"a|attr:href"}'

You can use any valid JavaScript code with jQuery and Underscore to parse HTML and look for something interesting.

Test

  • brew install jq bats
  • bats test/*.bats

Release History

  • 2014-01-16 0.0.1 init
  • 2014-02-08 0.0.5 add plugins support, now available table2csv
  • 2014-08-12 0.0.7 add attr plugin, see example above
  • 2014-08-12 0.0.8 add csv plugin, see example above
  • 2015-11-16 0.5.0 add json plugin, add test
  • 2015-11-29 0.6.0 add json2 plugin, update test
  • 2018-06-03 1.0.0 upgrade cheerio version to 1.0.0-rc.2, use lodash replace underscore

License

Copyright (c) 2018 lyuehh. Licensed under the MIT license.