RSS web feeds swiss army knife
Project description
Swiss RSS
RSS web feeds swiss army knife
Features
- RSS/Atom feed parsing and discovery
- Website favicon download and conversion
- OPML feed list parsing
- Timestamp parsing for multiple formats
Installation
pip install swiss-rss
Usage
Web Feeds
import asyncio
from swiss_rss.web_feeds import parse_feed_from_url, discover_feed
async def main():
try:
# Find and parse a feed
feed_url = await discover_feed("https://2ality.com")
if not feed_url:
print("No feed found")
return
print(f"Found feed: {feed_url}")
feed = await parse_feed_from_url(feed_url)
# Access feed data
print(f"Title: {feed.title}")
if feed.items:
print(f"Latest post: {feed.items[0].title}")
except Exception as e:
print(f"Error: {e}")
asyncio.run(main())
Favicons
from swiss_rss.favicons.favicon_parser import download_favicon
try:
# Download and convert favicon to 32x32 PNG
favicon_data = download_favicon("https://example.com")
if favicon_data:
with open("favicon.png", "wb") as f:
f.write(favicon_data)
except Exception as e:
print(f"Error downloading favicon: {e}")
OPML
from swiss_rss.opml.opml_parser import parse_opml
try:
with open("feeds.opml") as f:
feeds = parse_opml(f.read())
for feed in feeds:
print(f"Feed: {feed.title} ({feed.xml_url})")
except Exception as e:
print(f"Error parsing OPML: {e}")
Timestamps
from swiss_rss.timestamps.timestamp_parser import parse_date
# Supports RFC 822, ISO 8601 and other common formats
date = parse_date("Sat, 03 Jun 2023 10:00:00 GMT")
print(f"Parsed date: {date}")
Additional Web Feed Features
from swiss_rss.web_feeds import parse_feed, FeedInfo, FeedItem
# Parse feed content directly
feed_content = '''<?xml version="1.0"?>
<rss version="2.0">
<!-- RSS content here -->
</rss>'''
feed = parse_feed(feed_content)
# Access additional fields
for item in feed.items:
print(f"Author: {item.author}")
print(f"ID: {item.id}")
Additional Favicon Features
from swiss_rss.favicons.favicon_parser import (
convert_to_png,
resize_favicon,
decode_base64_image
)
# Convert image to PNG
png_data = convert_to_png(image_data)
# Resize favicon with custom size
resized_data = resize_favicon(favicon_data, size=64)
# Handle base64 encoded images
image_data = decode_base64_image("data:image/png;base64,...")
Development
- Clone the repository and install dependencies:
git clone https://github.com/aluxian/swiss-rss.git
cd swiss-rss
uv venv
source .venv/bin/activate
uv sync
- Run linting checks:
uv run ruff check .
- Run tests:
uv run pytest
- Start Aider:
uvx --python 3.12 --from 'aider-chat[playwright]' --with 'aider-chat[help]' aider
Project details
Release history Release notifications | RSS feed
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 swiss_rss-0.1.1.tar.gz.
File metadata
- Download URL: swiss_rss-0.1.1.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31724d12cad4a94a44e8c13a01d41d84a7f0ccf186831df1d6cd80e5143da70e
|
|
| MD5 |
c158d01b8daf9012bbf4cfbe49e3e80f
|
|
| BLAKE2b-256 |
347285834e80b8e607da3b5ce5533a05ccfe4ff2930d9e55f273872f9348a133
|
Provenance
The following attestation bundles were made for swiss_rss-0.1.1.tar.gz:
Publisher:
python-publish.yml on aluxian/swiss-rss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swiss_rss-0.1.1.tar.gz -
Subject digest:
31724d12cad4a94a44e8c13a01d41d84a7f0ccf186831df1d6cd80e5143da70e - Sigstore transparency entry: 157381602
- Sigstore integration time:
-
Permalink:
aluxian/swiss-rss@932e7a3a10d8e26cedcc7eb21e0c141b1cdac5a6 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/aluxian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@932e7a3a10d8e26cedcc7eb21e0c141b1cdac5a6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file swiss_rss-0.1.1-py3-none-any.whl.
File metadata
- Download URL: swiss_rss-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4e50fefd41bdb9c623d5cc50076f8a801d589ec492c682922adaf2662cae1ce
|
|
| MD5 |
b25cd7d7b929395462bea5c0cd6e99a4
|
|
| BLAKE2b-256 |
06176a200a8bec0f26fb5863e80b4bc3faa0b5ba0586587d2c5cbb8cbbca2e48
|
Provenance
The following attestation bundles were made for swiss_rss-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on aluxian/swiss-rss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swiss_rss-0.1.1-py3-none-any.whl -
Subject digest:
a4e50fefd41bdb9c623d5cc50076f8a801d589ec492c682922adaf2662cae1ce - Sigstore transparency entry: 157381603
- Sigstore integration time:
-
Permalink:
aluxian/swiss-rss@932e7a3a10d8e26cedcc7eb21e0c141b1cdac5a6 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/aluxian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@932e7a3a10d8e26cedcc7eb21e0c141b1cdac5a6 -
Trigger Event:
release
-
Statement type: