Skip to main content

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>&#x03C0;</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


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.1.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

haruka_parser-0.4.1-py3-none-any.whl (69.9 kB view details)

Uploaded Python 3

File details

Details for the file haruka_parser-0.4.1.tar.gz.

File metadata

  • Download URL: haruka_parser-0.4.1.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for haruka_parser-0.4.1.tar.gz
Algorithm Hash digest
SHA256 b3b444c91a6b03cfe4cfdbf464ae4e3f10f2e1cd3de59449defbbd4004bf0ef2
MD5 038a343d897accc10fb0726baf1b1bcc
BLAKE2b-256 73751a25f9023fb06b91360b752854413689c6010c69d9c3750b34a06a7f498d

See more details on using hashes here.

File details

Details for the file haruka_parser-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for haruka_parser-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2132b505dd20d30a2b665dafa06ab349e024fa5b8de20ec1600c5ede38b217c7
MD5 a2ad99815ded1dadfa0a75d11bd3dea8
BLAKE2b-256 c645b45632292d574e7404063e78ccba2cfee2eed1f77cdaff53a4856deb3cb4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page