High performance RSS, Atom and RDF parser in Python
Project description
FastFeedParser
A high-performance RSS, Atom, and RDF feed parser for Python. FastFeedParser is designed to be fast, memory-efficient, and easy to use while providing comprehensive feed parsing capabilities.
Why FastFeedParser?
The main advantage of FastFeedParser over the traditional feedparser library is its lightweight design and exceptional performance - benchmarks show it's 10x-100x faster than feedparser while maintaining a familiar API. This dramatic speed improvement is achieved through:
- Efficient XML parsing using lxml
- Optimized memory usage
- Minimal dependencies
- Streamlined codebase focused on core functionality
FastFeedParser is used for high performance processing of thousands of feeds for Kagi Small Web initiative.
Features
- Fast parsing of RSS 2.0, Atom 1.0, and RDF/RSS 1.0 feeds
- Robust error handling and encoding detection
- Support for media content and enclosures
- Automatic date parsing and standardization to UTC ISO 8601 format
- Clean, Pythonic API similar to feedparser
- Comprehensive handling of feed metadata
- Support for various feed extensions (Media RSS, Dublin Core, etc.)
Installation
pip install fastfeedparser
Quick Start
import fastfeedparser
# Parse from URL
myfeed = fastfeedparser.parse('https://example.com/feed.xml')
# Parse from string
xml_content = '''<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Example Feed</title>
...
</channel>
</rss>'''
myfeed = fastfeedparser.parse(xml_content)
# Access feed global information
print(myfeed.feed.title)
print(myfeed.feed.link)
# Access feed entries
for entry in myfeed.entries:
print(entry.title)
print(entry.link)
print(entry.published)
Key Features
Feed Types Support
- RSS 2.0
- Atom 1.0
- RDF/RSS 1.0
Content Handling
- Automatic encoding detection
- HTML content parsing
- Media content extraction
- Enclosure handling
Metadata Support
- Feed title, link, and description
- Publication dates
- Author information
- Categories and tags
- Media content and thumbnails
API Reference
Main Functions
parse(source)
: Parse feed from a source that can be URL or a string
Feed Object Structure
The parser returns a FastFeedParserDict
object with two main sections:
feed
: Contains feed-level metadataentries
: List of feed entries
Each entry contains:
title
: Entry titlelink
: Entry URLdescription
: Entry description/summarypublished
: Publication dateauthor
: Author informationcontent
: Full contentmedia_content
: Media attachmentsenclosures
: Attached files
Requirements
- Python 3.7+
- httpx
- lxml
- parsedatetime
- python-dateutil
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Inspired by the Universal Feed Parser (feedparser) project, FastFeedParser aims to provide a modern, high-performance alternative while maintaining a familiar API.
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
File details
Details for the file fastfeedparser-0.2.2.tar.gz
.
File metadata
- Download URL: fastfeedparser-0.2.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81028bb9022e18fb6b15859ee10d7fd13c3328181cf65554837cef944fd63e2 |
|
MD5 | 9a913b895723683d5605b4221548b833 |
|
BLAKE2b-256 | b06c23004e7718547863c38feddd192d8897967677af85ccb62693357803fb46 |
File details
Details for the file fastfeedparser-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: fastfeedparser-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a23ee5d777721d9d192016978679b5d0401481fa04de26ffa9b9a7daa71f0cdd |
|
MD5 | 185618f48e6c220e7ca5607ee5afab06 |
|
BLAKE2b-256 | 524deb658ebce08b242b644aae12a506dce5456d5a0d2ebf3b650107642685b4 |