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

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

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_fatihky-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

purehtml_fatihky-0.1.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file purehtml_fatihky-0.1.0.tar.gz.

File metadata

  • Download URL: purehtml_fatihky-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for purehtml_fatihky-0.1.0.tar.gz
Algorithm Hash digest
SHA256 968a22dbcc65704788a2d4b587cc3a858ae998d929f338e4e2964b67fc3d0919
MD5 d3b8f589aefcbbed9a98143f5443c6c0
BLAKE2b-256 a0e2369496ce63b5441957a6faffe7b746b993ab66e3f56760a707505b686053

See more details on using hashes here.

File details

Details for the file purehtml_fatihky-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for purehtml_fatihky-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe2fdb33a1c4f81665de3884e8f9910fa78eb409aecf2d2c09f1407bd8aab39
MD5 3ff9a2ef10b79d24594b6acbf7a3a476
BLAKE2b-256 9f1c2d22984dd39bb6ee6e7cc80437b42178c13cd3ea177c586dbeb11719b805

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