Skip to main content

peduncle

very very very simple DOM based HTML content extraction tool, get rid of boilerplate dressing of a web page[1].

easy but useable

work with python 3.7+

[1] the word comes from dragnet.

install

pip install peduncle

usage

import requests
from peduncle.peduncle import extract_text

# obtain the raw html
url="https://blog.rust-lang.org/2023/05/29/RustConf.html"
html = requests.get(url).text

# extract
print(extract_text(html))

benchmark

data

benchmark data comes from dragnet_data, which contains 1381 web pages.

result

similarity 95%hit_rate avg_length_gap(char) length_gap_std
a=0.01 0.5767456743946341 0.22 -4673.118 15343.704819895227
a=025 0.8451692708814662 0.548 -2082.988 14502.183923390849
a=0.5 0.8226224698726087 0.47 -368.696 8452.075615349402
a=0.99 0.7527591593485807 0.292 1614.306 7917.618208044891
  • a: alpha, control how much the content extractor tens to extract larger content piece
  • similarity: cosine similarity between sparse vectors of answer and extracted text
  • 95hit rate: percentage of similarity larger than 95%
  • length gap: extracted text length - answer text length
  • std: std

Release files for peduncle 0.0.2

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

Source distribution (sdist)

Source distribution for peduncle 0.0.2
File Size Uploaded
peduncle-0.0.2.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for peduncle 0.0.2
File Interpreter ABI Platform
peduncle-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / peduncle-0.0.2.tar.gz

Download URL peduncle-0.0.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cd0dc6a7d9bad888ebb819db7ef8903839c4e31fdf38414e8b02110e904b068b
BLAKE2b-256 checksum
How to use checksums
488da29dce88ccf0fad1da6b212a0cfe2a4d608ed2703c822ab9359a83a63fdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / peduncle-0.0.2-py3-none-any.whl

Download URL peduncle-0.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a4ec0219ff0accfdcf1f3d6b525aebb2412c75cbe4a4937307f1863c6a284c6
BLAKE2b-256 checksum
How to use checksums
a54ad359f0c57754bbfe71cd0494f2d3c6bbfdc87f9c82294e09b42180269082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

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