A simple HTML Parser
Project description
Haruka Parser
A simple HTML Parser
Install
pip install haruka-parser
Usage
from haruka_parser.extract import extract_text
html = """<!DOCTYPE html>
<html>
<body>
<!-- Using MathML -->
<p>Using MathJax:</p>
<script type="math/tex; mode=display" id="MathJax-Element-1">{e}^{i\pi }=-1</script>
<!-- Using MathML -->
<p>Using MathML:</p>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>e</mi>
<mrow>
<mi>i</mi>
<mi>π</mi>
</mrow>
</msup>
<mo>=</mo>
<mn>-1</mn>
</math>
<!-- Using AsciiMath -->
<p>Using AsciiMath:</p>
<script type="math/asciimath">
e^(i*pi) = -1
</script>
</body>
</html>"""
text, info = extract_text(html)
print(text)
print(info)
Configurations
from haruka_parser.extract import DEFAULT_CONFIG
DEFAULT_CONFIG = {
"readability": False,
"skip_large_links": False,
"extract_latex": True,
"extract_cnki_latex": False,
"escape_dollars": True,
"remove_buttons": True,
"remove_edit_buttons": True,
"remove_image_figures": True,
"markdown_code": True,
"markdown_headings": True,
"remove_chinese": False,
"boilerplate_config": {
"enable": False,
"ratio_threshold": 0.18,
"absolute_threshold": 10,
"end_threshold": 15,
},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
haruka_parser-0.4.0.tar.gz
(64.9 kB
view details)
Built Distribution
File details
Details for the file haruka_parser-0.4.0.tar.gz
.
File metadata
- Download URL: haruka_parser-0.4.0.tar.gz
- Upload date:
- Size: 64.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f6f3306e5bf38b364ab19ee1a7d66f2a9a1f25b9f054e7b875f5a474f899268 |
|
MD5 | c4d3acd2a41c87171cff12e348c3ccff |
|
BLAKE2b-256 | 66a98e211c008e8e4a3e5ae60f55b1b747252299d44a1c002a84c7dae0656cef |
File details
Details for the file haruka_parser-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: haruka_parser-0.4.0-py3-none-any.whl
- Upload date:
- Size: 69.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1718c67114377f99867630b331976e52d46573fde2768846c60ed94dcf5ffc83 |
|
MD5 | 033f1ecb3fde7a0958fa73e94b502f89 |
|
BLAKE2b-256 | d1e78dda8a8c93c9a63bed9e34e5946eac19cfd75ad3abfd7f6c6ec2b7d5867f |