Skip to main content

CSS selectors for parsing html on the command line

Project description

Slice and dice html on the command line using CSS selectors.


Let’s say you want to grab all the links on

$ curl | que "a->href"

Let’s say that gave you 3 lines that looked like this:


Ugh, that’s not very helpful, so let’s modify our selection:

$ curl | que "a->{href}"

Now, that will print:


Not sure how to use CSS Selectors?

The selector is divided into two parts separated by ->, the first part is the traditional selector talked about in the above links and the second part is the attributes you want to print to the screen for each match:

$ css.selector->attribute,selector

The Selector part uses Python’s string formatting syntax so you can embed the attributes you want within a larger string.


  • If you need a way more fully featured html command line parser, try hq.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

que-0.0.1.tar.gz (3.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page