Skip to main content

A CLI tool to make HTML greppable

Project description

Greml

Make HTML greppable!

A simple tool to allow you to grep HTML.

Installation

The recommended way to install is to use pipx:

pipx install greml

Usage

Specify a HTML document, either piped as stdin, or a file or HTTP request and a selector (provided by Soup Sieve).

The output may be the text of the elements, a JSON representation of the element (including all attributes) that may be parsed further using jq or the value of specific attributes.

%  greml --help

 Usage: greml [OPTIONS] [INPUT_PATH] [SELECTOR]

╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│   input_path      [INPUT_PATH]  Input file path or URL. If not specified uses stdin. [default: (stdin)]                                                           │
│   selector        [SELECTOR]    HTML selector [default: None]                                                                                                     │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --display                     TEXT                             How to display, either 'text', 'json' or 'attr.ATTR' [default: text]                               │
│ --version             -v                                                                                                                                          │
│ --install-completion          [bash|zsh|fish|powershell|pwsh]  Install completion for the specified shell. [default: None]                                        │
│ --show-completion             [bash|zsh|fish|powershell|pwsh]  Show completion for the specified shell, to copy it or customize the installation. [default: None] │
│ --help                                                         Show this message and exit.                                                                        │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Exampless

% greml https://www.yourlifedoncaster.co.uk/trees-and-woodlands '#treeCounter'
108,000
% greml https://github.com/adamckay 'img[alt^="Achievement: "]' --display attr.alt | sort | uniq
Achievement: Arctic Code Vault Contributor
Achievement: Pull Shark
Achievement: Quickdraw
Achievement: YOLO

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

greml-0.1.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

greml-0.1.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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