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 to effeciently process thousands of feeds for Kagi's 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 with timezone handling
- 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
feed = 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.0.tar.gz
.
File metadata
- Download URL: fastfeedparser-0.2.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab2b2112e786685f320f53b929162de4285d00d440dabbb7d75e5dd4cdfed484 |
|
MD5 | 6798184cac8fa0fe7f67eaa7e753116a |
|
BLAKE2b-256 | 55e41a9da4e3b548538844c615795970f5daa8464ffcbaed0a3859112e64c926 |
File details
Details for the file fastfeedparser-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: fastfeedparser-0.2.0-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 | f3f8a5f5301aeb4eb352889d422522f34f560bef43acadab8ff653f78a56e564 |
|
MD5 | 694cce4b63f048fd5bdcc53a0fa4dde9 |
|
BLAKE2b-256 | bc25b846ae5f3789d70c69b69978757991e705cff164794c195367f3a1ac344c |