Skip to main content

Xcrap Parser

Xcrap Parser is a declarative, model-driven parser for extracting data from HTML and JSON files, with the ability to interleave both to extract even more information.

It is inspired by the parser embedded in the Xcrap Framework available for Node.js. It was built using Parsel for HTML parsing and JMESPath for JSON parsing.

Installation

pip install xcrap-parser

Simple Usage

from xcrap_parser import HtmlParsingModel

html = "<html><title>Title</title><body><h1>Heading</h1></body></html>"

root_parsing_model = HtmlParsingModel({
    "title": {
        "query": "title::text"
    },
    "heading": {
        "query": "h1::text"
    }
})

data = root_parsing_model.parse(html)

print(data)

Metadata

Release files for xcrap-parser 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xcrap-parser 0.1.1
File Size Uploaded
xcrap_parser-0.1.1.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xcrap-parser 0.1.1
File Interpreter ABI Platform
xcrap_parser-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / xcrap_parser-0.1.1.tar.gz

Download URL xcrap_parser-0.1.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a72a120914054f31e494b6852314fd8507c0ee3595a80816565eaf78336e9acd
BLAKE2b-256 checksum
How to use checksums
b583392d85491696504a296d874d42661884f91e7041b4b0ee739b3b42ed93a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.2 Windows/10

Release files / xcrap_parser-0.1.1-py3-none-any.whl

Download URL xcrap_parser-0.1.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
412805eebd452ecc5d44418bcd8facd57e33830550b32511d75f161eadbe8e92
BLAKE2b-256 checksum
How to use checksums
4baf2ab6fe18dde51af3993b49a06097d28f54523013ca8482c72b899ecb1fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.2 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page