Habraloader
Habraloader is a lightweight Python library for parsing articles and downloading embedded media from Habr. It extracts essential metadata (title, author, publication date), retrieves the main body content in both HTML and plain text formats, and provides built-in utilities to download all article images directly to your local filesystem.
Features
- Article Metadata Parsing: Extract article ID, title, author username, and ISO publication timestamp.
- Dual Content Extraction: Retrieve full article content in HTML string format or clean plain text.
- Image URL Extraction: Automatically discover unique image URLs from
<img>and<source>tags. - Batch Image Downloader: Download all images associated with an article into organized output directories.
- Session Management: Built-in connection management using
requests.Sessionwith realistic User-Agent headers.
Quickstart
Below is a complete example showing how to initialize the parser, fetch an article by its ID, save it as a Markdown file, and download its images:
from habraloader import HabrParser
parser = HabrParser()
article = parser.get_article(668378)
print(f"Title: {article.title}")
print(f"Author: {article.author}")
# Save article to a Markdown file
file_path = article.save_md()
print(f"Article successfully saved to: {file_path}")
# Download images (if any)
saved_files = article.save_images(target_dir="downloaded_images")
print(f"Successfully saved images: {len(saved_files)}")
Metadata
Release files for habraloader 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| habraloader-1.0.0.tar.gz | 38.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| habraloader-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / habraloader-1.0.0.tar.gz
| Download URL | habraloader-1.0.0.tar.gz |
|---|---|
| Size | 38.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
945f74062745138934cf6665a64607bc608f17389ac8ec8433a28994b58919d7
|
|
BLAKE2b-256 checksum How to use checksums |
38ef45f79cf9b45aa2d2cd92a7c91910213e9a95eac3d1d35d739f1db863c032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.13.7"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.7","system":{"name":"Windows","release":"11"}} HTTPX2/2.10.0
|
Release files / habraloader-1.0.0-py3-none-any.whl
| Download URL | habraloader-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
155c4f1faec175c4448e8123668259478b17f80a0674fd71841c041d6e6aaa5f
|
|
BLAKE2b-256 checksum How to use checksums |
9242515e758dcdf0f08f83f46cd59e99e33e7f2ee36a12047a29e4443b463066
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.13.7"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.7","system":{"name":"Windows","release":"11"}} HTTPX2/2.10.0
|