11# feedparser-rs
22
3+ [ ![ PyPI] ( https://img.shields.io/pypi/v/feedparser-rs )] ( https://pypi.org/project/feedparser-rs/ )
4+ [ ![ Python] ( https://img.shields.io/pypi/pyversions/feedparser-rs )] ( https://pypi.org/project/feedparser-rs/ )
5+ [ ![ License] ( https://img.shields.io/badge/license-MIT%2FApache--2.0-blue )] ( LICENSE-MIT )
6+
37High-performance RSS/Atom/JSON Feed parser for Python with feedparser-compatible API.
48
59## Features
610
711- ** Fast** : Native Rust implementation via PyO3
12+ - ** HTTP fetching** : Built-in URL fetching with compression (gzip, deflate, brotli)
13+ - ** Conditional GET** : ETag/Last-Modified support for efficient polling
814- ** Tolerant parsing** : Bozo flag for graceful handling of malformed feeds
915- ** Multi-format** : RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
1016- ** Podcast support** : iTunes and Podcast 2.0 namespace extensions
@@ -19,6 +25,8 @@ pip install feedparser-rs
1925
2026## Usage
2127
28+ ### Basic Parsing
29+
2230``` python
2331import feedparser_rs
2432
@@ -36,6 +44,24 @@ for entry in d.entries:
3644 print (entry.published_parsed) # time.struct_time
3745```
3846
47+ ### Fetching from URL
48+
49+ ``` python
50+ import feedparser_rs
51+
52+ # Fetch and parse in one call
53+ d = feedparser_rs.parse_url(' https://example.com/feed.xml' )
54+
55+ print (d.feed.title)
56+ print (f " Fetched { len (d.entries)} entries " )
57+
58+ # With custom limits
59+ limits = feedparser_rs.ParserLimits(max_entries = 100 )
60+ d = feedparser_rs.parse_url_with_limits(' https://example.com/feed.xml' , limits)
61+ ```
62+
63+ > ** Note** : ` parse_url ` supports automatic compression (gzip, deflate, brotli) and follows redirects.
64+
3965## Migration from feedparser
4066
4167``` python
@@ -46,9 +72,10 @@ d = feedparser.parse(feed_content)
4672# Option 2: direct import
4773import feedparser_rs
4874d = feedparser_rs.parse(feed_content)
49- ```
5075
51- > ** Note** : URL fetching is not yet implemented. Use ` requests.get(url).content ` to fetch feeds.
76+ # Option 3: URL fetching (new!)
77+ d = feedparser_rs.parse_url(' https://example.com/feed.xml' )
78+ ```
5279
5380## Advanced Usage
5481
@@ -99,7 +126,9 @@ for entry in d.entries:
99126### Functions
100127
101128- ` parse(source) ` — Parse feed from bytes or str
129+ - ` parse_url(url) ` — Fetch and parse feed from URL
102130- ` parse_with_limits(source, limits) ` — Parse with custom resource limits
131+ - ` parse_url_with_limits(url, limits) ` — Fetch and parse with custom limits
103132- ` detect_format(source) ` — Detect feed format without full parsing
104133
105134### Classes
@@ -134,4 +163,5 @@ MIT OR Apache-2.0
134163
135164- [ GitHub] ( https://github.com/bug-ops/feedparser-rs )
136165- [ PyPI] ( https://pypi.org/project/feedparser-rs/ )
166+ - [ Documentation] ( https://github.com/bug-ops/feedparser-rs#python )
137167- [ Issues] ( https://github.com/bug-ops/feedparser-rs/issues )
0 commit comments