BLECH is a tool designed to automatically identify and extract links to individual posts from a blog's main page, index, or feed. After identifying the links, it proceeds to fetch and parse the content of each blog post, making it easier to process, analyze, or archive blog data.
Project description
Blog Link Extractor & Content Handler (BLECH)
BLECH is a tool designed to automatically identify and extract links to individual posts from a blog's main page, index, or feed. After identifying the links, it proceeds to fetch and parse the content of each blog post, making it easier to process, analyze, or archive blog data.
Installation
From PyPI (Recommended)
# Install using pip
pip install blech
From Source
This project uses Poetry for dependency management. To install from source:
- Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
- Clone the repository and install dependencies:
git clone https://github.com/jkarenko/blog-link-extractor-content-handler
cd blog-link-extractor-content-handler
poetry install
Development
To run the development version:
poetry run blech [OPTIONS] <BASE_URL>
Publishing to PyPI
To publish this package to PyPI:
- Make sure you have the latest version of Poetry:
poetry self update
- Build the package:
poetry build
- Publish to PyPI (you'll need a PyPI account and API token):
# For the first time publishing
poetry publish --username __token__ --password your_api_token
# For subsequent updates
poetry publish --build
For more information on obtaining a PyPI API token, visit: https://pypi.org/help/#apitoken
Usage
blech [OPTIONS] <BASE_URL>
Positional Arguments:
<BASE_URL>: (Required) The starting URL of the blog's main page, index, or feed where post links can be found.
Options:
-o,--output <FILENAME>: (Optional) The file where extracted content should be saved. If not provided, a default filename will be generated based on the blog's domain (e.g.,example-blog.com_blog_posts.txt).-l,--lang <LANG_CODE>: (Optional) Filter posts by language code (e.g., 'en', 'fi'). This primarily works when the blog uses a WordPress REST API that supports language filtering.--one-file: (Optional) Save all blog posts to a single file instead of separate files. By default, each post is saved as a separate file in a directory named based on the output filename without the .txt extension (e.g.,example-blog.com_blog_posts).-h,--help: (Optional) Show this help message and exit.
Example:
# Scrape English posts from the blog archive and save to a specific file
poetry run blech --output my_blog_extract.txt --lang en https://example-blog.com/archive
# Scrape all posts and use the default filename
poetry run blech https://another-blog.org/
# Scrape posts and save each one as a separate file in a directory (default behavior)
poetry run blech https://example-blog.com/
# Scrape posts, specify output directory name, and save as separate files
poetry run blech --output custom_dir_name.txt https://example-blog.com/
# Scrape posts and save all to a single file
poetry run blech --one-file https://example-blog.com/
# Scrape posts, specify output filename, and save to a single file
poetry run blech --output custom_file_name.txt --one-file https://example-blog.com/
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blech-0.1.0.tar.gz.
File metadata
- Download URL: blech-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
911a11a6c7d9b1aaa881ccdaadb83f6869dc2dd93ca329289779b7a41dc82390
|
|
| MD5 |
45d10cd71e6b840230439e6f397ca54a
|
|
| BLAKE2b-256 |
6e1bf2eb1a6d8e4f3989b1f44d8edf7697d9f745ddc045b56821d2ccf5cd6cc3
|
File details
Details for the file blech-0.1.0-py3-none-any.whl.
File metadata
- Download URL: blech-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bb5e5f599dba03bc63cdfa6808999ab764c62ec45e6001e00ce3dbcc4130c2
|
|
| MD5 |
7b5024b1a542376d58cc862196082e99
|
|
| BLAKE2b-256 |
4f1f75d181ce9831ca28cf2f97512a9aa9266948b4ca6da997d9d5c73dcc73c5
|