Skip to main content

High-performance RSS/Atom/JSON Feed parser with feedparser-compatible API

Project description

feedparser-rs

PyPI Python License

High-performance RSS/Atom/JSON Feed parser for Python with feedparser-compatible API.

Features

  • Fast: Native Rust implementation via PyO3
  • HTTP fetching: Built-in URL fetching with compression (gzip, deflate, brotli)
  • Conditional GET: ETag/Last-Modified support for efficient polling
  • Tolerant parsing: Bozo flag for graceful handling of malformed feeds
  • Multi-format: RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
  • Podcast support: iTunes and Podcast 2.0 namespace extensions
  • Familiar API: Inspired by feedparser, easy migration path
  • DoS protection: Built-in resource limits

Installation

pip install feedparser-rs

Usage

Basic Parsing

import feedparser_rs

# Parse from string or bytes
d = feedparser_rs.parse('<rss>...</rss>')
d = feedparser_rs.parse(b'<rss>...</rss>')

# Access data
print(d.feed.title)
print(d.version)  # "rss20", "atom10", etc.
print(d.bozo)     # True if parsing errors occurred

for entry in d.entries:
    print(entry.title)
    print(entry.published_parsed)  # time.struct_time

Fetching from URL

import feedparser_rs

# Fetch and parse in one call
d = feedparser_rs.parse_url('https://example.com/feed.xml')

print(d.feed.title)
print(f"Fetched {len(d.entries)} entries")

# With custom limits
limits = feedparser_rs.ParserLimits(max_entries=100)
d = feedparser_rs.parse_url_with_limits('https://example.com/feed.xml', limits)

Note: parse_url supports automatic compression (gzip, deflate, brotli) and follows redirects.

Migration from feedparser

# Option 1: alias import
import feedparser_rs as feedparser
d = feedparser.parse(feed_content)

# Option 2: direct import
import feedparser_rs
d = feedparser_rs.parse(feed_content)

# Option 3: URL fetching (new!)
d = feedparser_rs.parse_url('https://example.com/feed.xml')

Advanced Usage

Custom Resource Limits

import feedparser_rs

limits = feedparser_rs.ParserLimits(
    max_feed_size_bytes=50_000_000,  # 50 MB
    max_entries=5_000,
    max_authors=20,
    max_links_per_entry=50,
)

d = feedparser_rs.parse_with_limits(feed_data, limits)

Format Detection

import feedparser_rs

version = feedparser_rs.detect_format(feed_data)
print(version)  # "rss20", "atom10", "json11", etc.

Podcast Support

import feedparser_rs

d = feedparser_rs.parse(podcast_feed)

# iTunes metadata
if d.feed.itunes:
    print(d.feed.itunes.author)
    print(d.feed.itunes.categories)

# Episode metadata
for entry in d.entries:
    if entry.itunes:
        print(f"Duration: {entry.itunes.duration}s")

API Reference

Functions

  • parse(source) — Parse feed from bytes or str
  • parse_url(url) — Fetch and parse feed from URL
  • parse_with_limits(source, limits) — Parse with custom resource limits
  • parse_url_with_limits(url, limits) — Fetch and parse with custom limits
  • detect_format(source) — Detect feed format without full parsing

Classes

  • FeedParserDict — Parsed feed result

    • .feed — Feed metadata
    • .entries — List of entries
    • .bozo — True if parsing errors occurred
    • .version — Feed version string
    • .encoding — Character encoding
  • ParserLimits — Resource limits configuration

Requirements

  • Python >= 3.9

Development

git clone https://github.com/bug-ops/feedparser-rs
cd feedparser-rs/crates/feedparser-rs-py
pip install maturin
maturin develop

License

MIT OR Apache-2.0

Links

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

feedparser_rs-0.2.0.tar.gz (111.2 kB view details)

Uploaded Source

Built Distributions

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

feedparser_rs-0.2.0-cp312-cp312-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.12Windows x86-64

feedparser_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

feedparser_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

File details

Details for the file feedparser_rs-0.2.0.tar.gz.

File metadata

  • Download URL: feedparser_rs-0.2.0.tar.gz
  • Upload date:
  • Size: 111.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for feedparser_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 be800940fec23d0744797702af705fe6b9d6e7fa00296013997233fe0a94378f
MD5 b1d84333362e6fd9e3ad0cbde7fbf855
BLAKE2b-256 cd72d213c831259631f976994231384ec309f5ff214f60b04ea9a339569e5735

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0.tar.gz:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feedparser_rs-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e38872ba1125a70c6611f18498d706ce879d12e80b7852bd2ee07636e89d77a4
MD5 2ac93d4ca15d807ecc0f90b3438706d2
BLAKE2b-256 f39a2d7f7c74b0c316adaffa7a3424c21672a6e3e178e045ce6d63530b9e02af

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feedparser_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a60f3255a5d82921bcd5a2de96abb5e92c488e5fdf7be8730d3dcfbaf253d21e
MD5 c5055eeab568810a1d122c3938cc3c31
BLAKE2b-256 365c759252fbe7439734a0565737cd1a004e54ac62bc78176971f29d66e63171

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feedparser_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8727590d7caa1c7aaa1e24791d01197599c11bb0a9270a4f0533c97926c31279
MD5 58fff71c97b57c893f3d719af7906df0
BLAKE2b-256 f8000005f03c450330c43a63335c6cb512da323354dfd5fcd211677a31bcf4db

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1035e59cc5cadac1237548bf849a5c336e9ec47b4f8ff9a4e837028c4e4e466d
MD5 1ce5721b7db07ab682a179c6b2ba17b0
BLAKE2b-256 67ba69f50f742e77fbf30cd1f6d7a8305e72db09dac43fc6467a433141248e5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 073cd77426c26f864eefd4a2b21a0a4776f4deabbab71fc6475d9f4ff20175f2
MD5 34dc881f50119015e52893af4cd2bfa9
BLAKE2b-256 70f24501f49dd1d695d7cb9072d0a988ff409a22fbb2642d0ab8d74e4294a623

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bug-ops/feedparser-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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