# 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](https://github.com/kagisearch/smallweb), 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
```bash
pip install fastfeedparser
```
## Quick Start
```python
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
```bash
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+
- dateparser
- lxml
- python-dateutil
## 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](https://github.com/kurtmckee/feedparser) project, FastFeedParser aims to provide a modern, high-performance alternative while maintaining a familiar API.
Raw data
{
"_id": null,
"home_page": "https://github.com/kagi-search/fastfeedparser",
"name": "fastfeedparser",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Vladimir Prelovac",
"author_email": "vlad@kagi.com",
"download_url": "https://files.pythonhosted.org/packages/ec/e7/cc2c1437483c3440e9611ba5c38a868563799e1548f29575f672b7645714/fastfeedparser-0.3.4.tar.gz",
"platform": null,
"description": "# FastFeedParser\n\nA 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.\n\n### Why FastFeedParser?\n\nIt's about 10x faster (check included `benchmark.py`) than popular feedparser\nlibrary while keeping a familiar API. This speed comes from:\n\n- lxml for efficient XML parsing\n- Smart memory management \n- Minimal dependencies\n- Focused, streamlined code\n\nPowers feed processing for [Kagi Small Web](https://github.com/kagisearch/smallweb), handling processing of thousands of feeds at scale.\n\n\n## Features\n\n- Fast parsing of RSS 2.0, Atom 1.0, and RDF/RSS 1.0 feeds\n- Robust error handling and encoding detection\n- Support for media content and enclosures\n- Automatic date parsing and standardization to UTC ISO 8601 format\n- Clean, Pythonic API similar to feedparser\n- Comprehensive handling of feed metadata\n- Support for various feed extensions (Media RSS, Dublin Core, etc.)\n\n\n## Installation\n\n```bash\npip install fastfeedparser\n```\n\n## Quick Start\n\n```python\nimport fastfeedparser\n\n# Parse from URL\nmyfeed = fastfeedparser.parse('https://example.com/feed.xml')\n\n# Parse from string\nxml_content = '''<?xml version=\"1.0\"?>\n<rss version=\"2.0\">\n <channel>\n <title>Example Feed</title>\n ...\n </channel>\n</rss>'''\nmyfeed = fastfeedparser.parse(xml_content)\n\n# Access feed global information\nprint(myfeed.feed.title)\nprint(myfeed.feed.link)\n\n# Access feed entries\nfor entry in myfeed.entries:\n print(entry.title)\n print(entry.link)\n print(entry.published)\n```\n\n## Run Benchmark\n\n```bash\npython benchmark.py\n```\n\nThis will run benchmark on a number of feeds with output looking like this\n\n```\nTesting https://gessfred.xyz/rss.xml\nFastFeedParser: 17 entries in 0.004s\nFeedparser: 17 entries in 0.098s\nSpeedup: 26.3x\n\nTesting https://fanf.dreamwidth.org/data/rss\nFastFeedParser: 25 entries in 0.005s\nFeedparser: 25 entries in 0.087s\nSpeedup: 17.9x\n\nTesting https://jacobwsmith.xyz/feed.xml\nFastFeedParser: 121 entries in 0.030s\nFeedparser: 121 entries in 0.166s\nSpeedup: 5.5x\n\nTesting https://bernsteinbear.com/feed.xml\nFastFeedParser: 11 entries in 0.007s\nFeedparser: 11 entries in 0.339s\nSpeedup: 50.1x\n```\n\n\n## Key Features\n\n### Feed Types Support\n- RSS 2.0\n- Atom 1.0\n- RDF/RSS 1.0\n\n### Content Handling\n- Automatic encoding detection\n- HTML content parsing\n- Media content extraction\n- Enclosure handling\n\n### Metadata Support\n- Feed title, link, and description\n- Publication dates\n- Author information\n- Categories and tags\n- Media content and thumbnails\n\n## API Reference\n\n### Main Functions\n\n- `parse(source)`: Parse feed from a source that can be URL or a string\n\n\n### Feed Object Structure\n\nThe parser returns a `FastFeedParserDict` object with two main sections:\n\n- `feed`: Contains feed-level metadata\n- `entries`: List of feed entries\n\nEach entry contains:\n- `title`: Entry title\n- `link`: Entry URL\n- `description`: Entry description/summary\n- `published`: Publication date\n- `author`: Author information\n- `content`: Full content\n- `media_content`: Media attachments\n- `enclosures`: Attached files\n\n## Requirements\n\n- Python 3.7+\n- dateparser\n- lxml\n- python-dateutil\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Acknowledgments\n\nInspired by the [feedparser](https://github.com/kurtmckee/feedparser) project, FastFeedParser aims to provide a modern, high-performance alternative while maintaining a familiar API.\n",
"bugtrack_url": null,
"license": null,
"summary": "High performance RSS, Atom and RDF parser in Python",
"version": "0.3.4",
"project_urls": {
"Bug Tracker": "https://github.com/kagi-search/fastfeedparser/issues",
"Homepage": "https://github.com/kagi-search/fastfeedparser"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c6c55a4187949bef1eb25de7a634058b2fefe73bba9a805a8c698aef8148d1c9",
"md5": "acf885d51f5ec508cc8951ffea3eec09",
"sha256": "3b793e6bc7cbfca310caca505544583486ca9ed2089653ab02048a3af210c04d"
},
"downloads": -1,
"filename": "fastfeedparser-0.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "acf885d51f5ec508cc8951ffea3eec09",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9787,
"upload_time": "2024-12-11T02:47:41",
"upload_time_iso_8601": "2024-12-11T02:47:41.767851Z",
"url": "https://files.pythonhosted.org/packages/c6/c5/5a4187949bef1eb25de7a634058b2fefe73bba9a805a8c698aef8148d1c9/fastfeedparser-0.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ece7cc2c1437483c3440e9611ba5c38a868563799e1548f29575f672b7645714",
"md5": "fe1ccb910faa4c32b32498b44560c652",
"sha256": "267143e41872478957b62047bdd6c7fcc0756e70c0a3120a46e16137bc0ed884"
},
"downloads": -1,
"filename": "fastfeedparser-0.3.4.tar.gz",
"has_sig": false,
"md5_digest": "fe1ccb910faa4c32b32498b44560c652",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11833,
"upload_time": "2024-12-11T02:47:42",
"upload_time_iso_8601": "2024-12-11T02:47:42.783094Z",
"url": "https://files.pythonhosted.org/packages/ec/e7/cc2c1437483c3440e9611ba5c38a868563799e1548f29575f672b7645714/fastfeedparser-0.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 02:47:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kagi-search",
"github_project": "fastfeedparser",
"github_not_found": true,
"lcname": "fastfeedparser"
}