platypush/platypush/plugins/http/request/rss.py
Fabio Manganiello 544979e7ff - Added position argument to music.mpd.add
- Added RSS feed parser plugin
2019-01-09 18:43:13 +01:00

23 lines
506 B
Python

import feedparser
from platypush.plugins import action
from platypush.plugins.http.request import HttpRequestPlugin
class HttpRequestRssPlugin(HttpRequestPlugin):
"""
Plugin to programmatically retrieve and parse an RSS feed URL.
Requires:
* **feedparser** (``pip install feedparser``)
"""
@action
def get(self, url):
response = super().get(url, output='text').output
feed = feedparser.parse(response)
return feed.entries
# vim:sw=4:ts=4:et: