Skip to main content

High performance RSS, Atom, JSON and RDF feed parser in Python

Project description

FastFeedParser

A high-performance feed parser for Python that handles RSS, Atom, and RDF. Built for speed, efficiency, and ease of use while delivering complete parsing capabilities.

Why FastFeedParser?

It's about 10x faster (check included benchmark.py) than popular feedparser library while keeping a familiar API. This speed comes from:

  • lxml for efficient XML parsing
  • Smart memory management
  • Minimal dependencies
  • Focused, streamlined code

Powers feed processing for Kagi Small Web, handling processing of thousands of feeds at scale.

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)

Run Benchmark

python benchmark.py

This will run benchmark on a number of feeds with output looking like this

Testing https://gessfred.xyz/rss.xml
FastFeedParser: 17 entries in 0.004s
Feedparser: 17 entries in 0.098s
Speedup: 26.3x

Testing https://fanf.dreamwidth.org/data/rss
FastFeedParser: 25 entries in 0.005s
Feedparser: 25 entries in 0.087s
Speedup: 17.9x

Testing https://jacobwsmith.xyz/feed.xml
FastFeedParser: 121 entries in 0.030s
Feedparser: 121 entries in 0.166s
Speedup: 5.5x

Testing https://bernsteinbear.com/feed.xml
FastFeedParser: 11 entries in 0.007s
Feedparser: 11 entries in 0.339s
Speedup: 50.1x

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 metadata
  • entries: List of feed entries

Each entry contains:

  • title: Entry title
  • link: Entry URL
  • description: Entry description/summary
  • published: Publication date
  • author: Author information
  • content: Full content
  • media_content: Media attachments
  • enclosures: Attached files

Requirements

  • Python 3.7+
  • lxml
  • python-dateutil

Optional extras:

  • brotli (pip install fastfeedparser[brotli]) for Content-Encoding: br
  • dateparser (pip install fastfeedparser[dateparser]) for the slowest date parsing fallback
  • pip install fastfeedparser[full] for both

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 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

fastfeedparser-0.5.3.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastfeedparser-0.5.3-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file fastfeedparser-0.5.3.tar.gz.

File metadata

  • Download URL: fastfeedparser-0.5.3.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for fastfeedparser-0.5.3.tar.gz
Algorithm Hash digest
SHA256 d4183faa9fd21cf27fad5279e3be9338cd81e480f4a5c585671726696c9b73a2
MD5 85e002fa071da05adbcd6f1277a422df
BLAKE2b-256 96fd3d44222a6ef0b289fbdfe8608967b633e5e5d183c3036318c8dfa0fe71f7

See more details on using hashes here.

File details

Details for the file fastfeedparser-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: fastfeedparser-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for fastfeedparser-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dbc5a650d27548bb754d4b26a0b7ee2760abfafbdfddb450a6fffe1466b3be76
MD5 71aae5d5389f425fcf3f83d4603842a0
BLAKE2b-256 91ea77fef0373869ac8d332287943f8116330d8ff123587192511807f0362f1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page