An open API service indexing awesome lists of open source software.

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

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 rssfeed

text = 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": "

Comments

"
},
{
"title": "14 years of systemd",
"author": "lwn.net via calvin",
"timestamp": 1739814564,
"url": "https://lwn.net/SubscriberLink/1008721/7c31808d76480012/",
"content": "

Comments

"
},
{
"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": "

Comments

"
}
]
}
```

> 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.