Skip to main content

Small scraping utilities for CLI and Python workflows.

Project description

scrape-smith

PyPI Python GitHub

No-dependency Python utilities for scraping workflows.

The package currently provides a scrape command with a table extraction tool. It can read HTML from a local file or HTTP(S) URL, extract tables, and write CSV or JSON output to a file.

Installation

scrape-smith requires Python 3.10 or newer.

python -m pip install scrape-smith

Quickstart

scrape tables <html-file-or-url>
scrape tables page.html
scrape tables https://example.com/page.html -o result.csv
scrape tables page.html --format json -o tables.json

Without -o, output is written to a safe source-based filename:

page.html -> page-tables.csv
https://yeiichi.github.io/claim-class-model -> claim-class-model-tables.csv

If the default filename already exists, scrape avoids overwriting it by adding a numeric suffix, such as page-tables-2.csv.

On success, scrape reports the written file to stdout:

Wrote 1 table to page-tables.csv

Use --quiet to suppress the success report.

Command Line

The command-line entry point is scrape.

scrape tables <html-file-or-url> [--format csv|json] [-o OUTPUT] [--index N] [--quiet]

Options:

  • --format: output format, either csv or json; defaults to csv
  • -o, --output: output file path; defaults to a safe source-based filename
  • --index: write one table by zero-based index
  • -q, --quiet: suppress success reports on stdout

Errors and validation messages are written to stderr. If --index is out of range, the command exits with status code 2.

Python API

Python APIs live under scrape_smith.tools.

from scrape_smith.tools.tables import extract_tables

tables = extract_tables("page.html")

Each extracted table has caption, headers, and rows fields. JSON output uses the same shape.

Documentation

Full documentation is available at https://scrape-smith.readthedocs.io/.

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

scrape_smith-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

scrape_smith-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file scrape_smith-0.1.1.tar.gz.

File metadata

  • Download URL: scrape_smith-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrape_smith-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ac775e08eabfe296f12ce3fdcc4237739dd9c5fd9d05dd8706ec7438f6699a8
MD5 2e145472a7273110d83205f269ba6082
BLAKE2b-256 4bcbf101a0798f960f29b8f2f08758f70e554250105241f80f1846dea1ce795b

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrape_smith-0.1.1.tar.gz:

Publisher: publish-pypi.yml on yeiichi/scrape-smith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrape_smith-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scrape_smith-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrape_smith-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0663b47794a3d8f5962126d689431ae49bcb3ffe2dbabade943cb3863a8cf14a
MD5 c0aa857b7ed13433578c52c9d38d83c8
BLAKE2b-256 db3d7051db0c1599960826106281a070c56dec0239dd15a6fbf3e6ea0cff0488

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrape_smith-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on yeiichi/scrape-smith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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