forked from platypush/platypush
544979e7ff
- Added RSS feed parser plugin
23 lines
506 B
Python
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:
|
|
|