Skip to main content

rss-parser

Typed, pydantic-powered RSS/Atom parsing for Python.

PyPI version Python versions Downloads Wheel status License

CI Docs PyPi publish

rss-parser turns RSS/Atom XML into typed pydantic models — autocomplete, validation, and clear errors instead of digging through nested dicts.

Documentation

At a glance

Ecosystem Python 3.10+ — installed with pip install rss-parser, imported as rss_parser. This is not the npm package of the same name; there is no JavaScript/Node.js distribution.
Feed formats RSS 2.0, RSS 0.91/0.92, Atom 1.0, RSS 1.0 (RDF), plus typed Apple Podcasts (itunes:*) extensions
Runtime dependencies pydantic v2 (>=2.7), xmltodict, typing-extensions
Repository github.com/dhvcc/rss-parser
Documentation dhvcc.github.io/rss-parser
Package pypi.org/project/rss-parser
License GPL-3.0
Issues github.com/dhvcc/rss-parser/issues
Security Report vulnerabilities privately — see SECURITY.md. Do not open a public issue.

Installation

pip install rss-parser

Quickstart

from rss_parser import parse
from requests import get  # noqa

rss_url = "https://rss.art19.com/apology-line"
response = get(rss_url)

feed = parse(response.text)  # detects RSS 2.0 / 0.9x, Atom 1.0 or RSS 1.0 (RDF)

print("Language", feed.channel.language)
print("RSS", feed.version)

for item in feed.channel.items:
    print(item.title)
    print(str(item.description)[:50])

# Language en
# RSS 2.0
# Wondery Presents - Flipping The Bird: Elon vs Twitter
# <p>When Elon Musk posted a video of himself arrivi
# Introducing: The Apology Line
# <p>If you could call a number and say you’re sorry

parse() picks the right parser from the XML root element and raises UnknownFeedTypeError if the document is not a feed. If you already know the feed type, use the explicit parsers: RSSParser, AtomParser, RDFParser, PodcastParser.

Podcasts

itunes:* tags are supported out of the box, fully typed:

from rss_parser import PodcastParser

podcast = PodcastParser.parse(feed_xml)
channel = podcast.channel.content

channel.itunes_author                    # 'Wondery'
channel.itunes_owner.content.email       # 'iwonder@wondery.com'
channel.itunes_image.attributes["href"]  # artwork url

episode = channel.items[0].content
episode.itunes_duration                  # '00:05:01'
episode.itunes_episode_type              # 'trailer'

Custom fields: one subclass away

The models are generic, so extending the schema doesn't require re-declaring the whole tree:

from typing import Optional
from pydantic import Field

from rss_parser import RSSParser
from rss_parser.models.rss import RSS, Channel, Item
from rss_parser.models.types import Tag


class MyItem(Item):
    dc_creator: Optional[Tag[str]] = Field(alias="dc:creator", default=None)


rss = RSSParser.parse(data, schema=RSS[Channel[MyItem]])

rss.channel.items[0].content.dc_creator

And even without a custom schema, unknown tags are never dropped — they're kept in model_extra:

rss = RSSParser.parse(podcast_xml)
rss.channel.content.model_extra["itunes:author"]  # 'Wondery'

See Customizing the schema for mixins, repeatable tags, and the field types cheat sheet.

Migrating from 3.x

4.0 removes the legacy pydantic v1 models, fixes several RSS 2.0 spec violations, and makes the models generic and lossless. See the migration guide for the full list.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Install dependencies with uv sync (install uv).

Using pre-commit is highly recommended. To install hooks, run:

uv run pre-commit install -t=pre-commit -t=pre-push

See Contributing for tests, snapshots, and docs.

License

GPLv3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rss_parser-4.1.0.tar.gz (320.9 kB view details)

Uploaded Source

Built Distribution

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

rss_parser-4.1.0-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file rss_parser-4.1.0.tar.gz.

File metadata

  • Download URL: rss_parser-4.1.0.tar.gz
  • Upload date:
  • Size: 320.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rss_parser-4.1.0.tar.gz
Algorithm Hash digest
SHA256 d8c14931132bc45243d4087e7ecc36b84d8082c1ec191b592cb737cd9d78843d
MD5 37e6e3356c97ad7f2e7c4e12e5a4bbfb
BLAKE2b-256 a95a4714ad1323e2af653f26fc1b62bd36a1e634704ed6a94ac5fe4a21c96705

See more details on using hashes here.

File details

Details for the file rss_parser-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: rss_parser-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rss_parser-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c479d627749e17eef0850158920c5c33ed0fd4d6882f1a533a4b6fd8a668e7a2
MD5 0ace28df549cc05cd7085e0695566e23
BLAKE2b-256 6dbc24163e59a16ee4d30960cccf6c27c16cf4fbfac42bc1f0fde73c05b15448

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 Sentry Error logging StatusPage Status page