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

[!IMPORTANT] Requires Python 3.9 or later.

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

[!NOTE] Date fields like published_parsed return time.struct_time for feedparser compatibility.

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)

[!TIP] 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

Platform Support

Pre-built wheels available for:

Platform Architecture
macOS Intel (x64), Apple Silicon (arm64)
Linux x64, arm64
Windows x64

Supported Python versions: 3.9, 3.10, 3.11, 3.12, 3.13

Development

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

License

Licensed under either of:

at your option.

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.1.tar.gz (112.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.1-cp312-cp312-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

feedparser_rs-0.2.1-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.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: feedparser_rs-0.2.1.tar.gz
  • Upload date:
  • Size: 112.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.1.tar.gz
Algorithm Hash digest
SHA256 c57b120490d436c7d529b0e9ef98629f806cfbd319440a91a5f092aab87c298e
MD5 9cebee6e8ceb58fef24974ec07d66508
BLAKE2b-256 a8b88722b3866dc00718f11080a7dc91491e6a360112c0464261041ef79fa5fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1.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.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 87d3dc02c47733e673e39a2a7bed2181f6067ee18ed5cd9a7aee51e98b7f3197
MD5 9eb3233b3416d115afdd54fddcb917ee
BLAKE2b-256 7ed57912971ac49b9414fe6a9d56fa264c1fdec124dc27105cd4f2fc697d3de2

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1-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.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d4c28a6ab854e7e947cc0b5be9fc7e86cf8dd16b0a9311a7672a70b3c0cd5ca
MD5 614f4dab935fb12af83937f97b511fbd
BLAKE2b-256 e52b4d81f2c731766e07bae9429ce9c6997a0daa756e64bde7e489dcf03abd1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1-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.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a8f49dc129e4dd2e9665c53e0dfab4664942077502721694efdc444f235fa09a
MD5 547322ec689afdc6a1b881b617c3cdce
BLAKE2b-256 a64ddc061d56fba5666938df1e74f62a428c676b0831201fa70ccd6336a5d4ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1-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.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a0cc691a2787454632862f3705dfc5e9e3f480caf6b05d4df7d4e21d18bbd1ed
MD5 dfbb74e3025e07945cca0d7d57dce216
BLAKE2b-256 6f8957cd89565d7c6324bb6007a86facb94dd756cb53bfa59e46bfdcbf15a248

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1-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.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for feedparser_rs-0.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c5bc1dfc858e4100bc229bfbd82ce67642bf9f8efbab1b06dd4f2a1fdf9aa5a1
MD5 f9bf3da8c220d92f5b89a0a17a64e61f
BLAKE2b-256 a3d5009e8eed508338755263b5d25c1dee990df8f39e0457a1e547ee8a0476ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for feedparser_rs-0.2.1-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