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

Uploaded Source

Built Distribution

haruka_parser-0.2.5-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: haruka_parser-0.2.5.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for haruka_parser-0.2.5.tar.gz
Algorithm Hash digest
SHA256 0a36fc348d33ed4d36ba25d9599de53cc7bbbf53476f8ab580b6ce2387655a9f
MD5 004cf146ae038a0f656574572d89fc7a
BLAKE2b-256 2b7423c78038ece7122eb20d6b5af6cc5079f3b8388eb78a13273e8f23a52418

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for haruka_parser-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9dab740a135539372c1627bba2dc38b961b23e53513511c74c649ff4436d8ad9
MD5 8aaf269bd1bc70d464d86a7d51c6b2f4
BLAKE2b-256 2c846d1ae0663e6b0acaf1b78109a2407fdfe00f962573d377ae2715187c7340

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