pquery
======
grep for HTML; CLI for pyquery
## Example
```
$curl -s https://github.com/hupili/pquery | pquery '.content a' -p text
.gitignore
LICENSE
MANIFEST.in
README.md
pquery
setup.py
```
## Syntax
```
Usage:
pquery <selector>
pquery <selector> -p <projector>
pquery <selector> -f <format_string>
pquery -h | --help
Options:
-p: project the dict onto field `<projector>`.
-f: equivalent of `<format_string>.format(item)`,
where item is the dict form of one selected HTML element.
-h | -v: shows this doc.
Dict keys:
'tag': The HTML tag
'html': Inner HTML of the element
'text': Inner text of the element
...: [optional] Other attributes: e.g. 'href'
```
## Why
`grep` is powerful for **lines**.
HTML is structured and not line processor friendly.
CSS selector is a natural grep for HTML.
This script simply wraps [pyquery](http://pyquery.readthedocs.org/en/latest/) to provide a CLI.
======
grep for HTML; CLI for pyquery
## Example
```
$curl -s https://github.com/hupili/pquery | pquery '.content a' -p text
.gitignore
LICENSE
MANIFEST.in
README.md
pquery
setup.py
```
## Syntax
```
Usage:
pquery <selector>
pquery <selector> -p <projector>
pquery <selector> -f <format_string>
pquery -h | --help
Options:
-p: project the dict onto field `<projector>`.
-f: equivalent of `<format_string>.format(item)`,
where item is the dict form of one selected HTML element.
-h | -v: shows this doc.
Dict keys:
'tag': The HTML tag
'html': Inner HTML of the element
'text': Inner text of the element
...: [optional] Other attributes: e.g. 'href'
```
## Why
`grep` is powerful for **lines**.
HTML is structured and not line processor friendly.
CSS selector is a natural grep for HTML.
This script simply wraps [pyquery](http://pyquery.readthedocs.org/en/latest/) to provide a CLI.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pquery-1.0.tar.gz
(2.2 kB
view details)
File details
Details for the file pquery-1.0.tar.gz.
File metadata
- Download URL: pquery-1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8e25a8d9e9809874ccb663954b6935592b5047fc7b4aa36b4c4397833263b54
|
|
| MD5 |
47739bed179a145bfc09b8b487944065
|
|
| BLAKE2b-256 |
08bbeb2c51e1d968eeee3b42fda8a9902abedad59327651cf9e14a47c2b0eb89
|