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]          │
│ --follow-redirects        --no-follow-redirects                                     [default: follow-redirects]                                                   │
│ --user-agent                                       TEXT                             Custom User-Agent header for HTTP requests [default: None]                    │
│ --user-agent-random                                                                 Use a random User-Agent header                                                │
│ --timeout                                          INTEGER                          Timeout in seconds for HTTP requests [default: 30]                            │
│ --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-1.1.0.tar.gz (100.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

greml-1.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file greml-1.1.0.tar.gz.

File metadata

  • Download URL: greml-1.1.0.tar.gz
  • Upload date:
  • Size: 100.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.0

File hashes

Hashes for greml-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c8277f6889209ed2fa1f19d636861e06dd3ee619c7646141d393a2b1d10bb3b2
MD5 7b1568f3f02f319a0c7d09739c4e95ac
BLAKE2b-256 00a51bfc74e69b6c78048015eca6c326500a488a54444ae9b39672f4ff1fbff9

See more details on using hashes here.

File details

Details for the file greml-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: greml-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.0

File hashes

Hashes for greml-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc395d85468bfc5a8a66227b0cd161f3b5b780a722b9d9aab9e2a7a9444aaebb
MD5 7e9629c72059d8482706881c4edbd62a
BLAKE2b-256 79065b41d0ec4253d752803eb752d8316225ef725748b560e46a50a9f1c47a26

See more details on using hashes here.

Supported by

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