https://github.com/p7e4/rssfeed
A simple rss/atom/opml parser
https://github.com/p7e4/rssfeed
feed rss rss-feed rss-feed-parser rss-parser
Last synced: 2 days ago
JSON representation
A simple rss/atom/opml parser
- Host: GitHub
- URL: https://github.com/p7e4/rssfeed
- Owner: p7e4
- License: gpl-3.0
- Created: 2024-06-02T03:28:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-18T11:54:48.000Z (5 months ago)
- Last Synced: 2025-07-09T06:42:26.257Z (5 days ago)
- Topics: feed, rss, rss-feed, rss-feed-parser, rss-parser
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rssfeed
A simple rss/atom/opml parser
## Installation
`pip install rssfeed`
## Get Started
### rss parse
``` python
import requests
import rssfeedtext = requests.get("https://lobste.rs/rss").text
rssfeed.parse(text)
`````` json
"
{
"name": "Lobsters",
"lastupdate": 1739824193,
"items": [
{
"title": "Why I'm Writing a Scheme Implementation in 2025 (The Answer is Async Rust)",
"author": "maplant.com by mplant",
"timestamp": 1739824193,
"url": "https://maplant.com/2025-02-17-Why-I'm-Writing-a-Scheme-Implementation-in-2025-(The-Answer-is-Async-Rust).html",
"content": "
},
{
"title": "14 years of systemd",
"author": "lwn.net via calvin",
"timestamp": 1739814564,
"url": "https://lwn.net/SubscriberLink/1008721/7c31808d76480012/",
"content": ""
},
{
"title": "Making the Web More Readable With Stylus",
"author": "wezm.net by wezm",
"timestamp": 1739757928,
"url": "https://www.wezm.net/v2/posts/2025/stylus/",
"content": ""
}
]
}
```> rssfeed **does not** escape HTML tag, which mean if you does not check the content and display it somewhere html can be rendered, it may lead to [Cross-site scripting](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks.
### opml parse
``` python
import rssfeed
opml = """
demo feeds
"""
rssfeed.opmlParse(opml)
``````` json
{
"default": [
{
"name": "阮一峰的网络日志",
"url": "https://feeds.feedburner.com/ruanyifeng"
}
],
"news": [
{
"name": "奇客Solidot",
"url": "https://www.solidot.org/index.rss"
},
{
"name": "Lobsters",
"url": "https://lobste.rs/rss"
}
]
}
```as you can see, a two-layer structure will always be generated regardless of the original structure. If the original file includes multiple levels, only the outermost menu is retained. If a feed on the root it will be place in `default` menu.