Skip to main content

HTML data extraction library

Project description

PureHTML

PureHTML is a parsing specification for extracting JSON from HTML.

Installation:

To install PureHTML, you can use pip with following command:

  pip install purehtml-purescraps

Usage

from purehtml import ConfigFactory, extract

yaml_string = """
selector: span
type: array
items: {}
"""
html_string = """
<div>
  <span>a</span>
  <span>b</span>
  <span>c</span>
</div>
"""
expected_output = "['a', 'b', 'c']"

config = ConfigFactory.from_yaml(yaml_string)

print(f"Extracted output : {extract(config, html_string, 'http://example.com')}")
print(f"Expected  output : {expected_output}")

Development

For testing, we use test specifications defined in <purehtml root>/specs. You may run python3 run_tests.py to check if the python implementation is working correctly or has some incompatibilities.

Building

  1. Install build pip with this command: python3 -m pip install --upgrade build
  2. Execute make clean build to create a clean build output. The output will be placed in dist/

Publishing to Python Package Index

  1. Install the twine package: python3 -m pip install --upgrade twine
  2. Publish to pypi: python3 -m twine upload dist/* or with make publish

License

MIT

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

purehtml_purescraps-0.1.3.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

purehtml_purescraps-0.1.3-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file purehtml_purescraps-0.1.3.tar.gz.

File metadata

  • Download URL: purehtml_purescraps-0.1.3.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for purehtml_purescraps-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0fad09103b57e228022e95721b74883fff258440bf5bb47d1fdf6796959065bc
MD5 91a82ba246bdb970eb9e0d75c535b223
BLAKE2b-256 6cac371c7ac625f5a1730366c3ebafdec9d4d09eaf62b9c60e13fb78fbab0119

See more details on using hashes here.

Provenance

The following attestation bundles were made for purehtml_purescraps-0.1.3.tar.gz:

Publisher: publish-python-package.yml on purescraps/purehtml

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

File details

Details for the file purehtml_purescraps-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for purehtml_purescraps-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0293a57639e62c38bcbf5415f42202c046a23d67965d615291d6d4e49aa4dff3
MD5 f98de8fa33dbfb1bb533d6b95fa27c6c
BLAKE2b-256 057b25fdc90274a40c7f85bc54bb636d7e403102869a16c852d998773a62a56b

See more details on using hashes here.

Provenance

The following attestation bundles were made for purehtml_purescraps-0.1.3-py3-none-any.whl:

Publisher: publish-python-package.yml on purescraps/purehtml

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