rss
#
- class platypush.plugins.rss.RssPlugin(subscriptions: Collection[str] | None = None, poll_seconds: int = 300, user_agent: str = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', **kwargs)[source]#
Bases:
RunnablePlugin
A plugin for parsing and subscribing to RSS feeds.
Triggers:
platypush.message.event.rss.NewFeedEntryEvent
when a new entry is received on a subscribed feed.
Requires:
feedparser (
pip install feedparser
)defusedxml (
pip install defusedxml
)
- __init__(subscriptions: Collection[str] | None = None, poll_seconds: int = 300, user_agent: str = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', **kwargs)[source]#
- Parameters:
subscriptions – List of feeds to monitor for updates, as URLs. OPML URLs/local files are also supported.
poll_seconds – How often we should check for updates (default: 300 seconds).
user_agent – Custom user agent to use for the requests.
- export_to_opml() str [source]#
Export the list of subscriptions into OPML format.
- Returns:
The list of subscriptions as a string in OPML format.
- get_latest_entries(limit: int = 20)[source]#
Get the latest entries from the subscribed feeds, sorted by descending published date.
- Parameters:
limit – Maximum number of entries to return (default: 20).
- Returns:
[ { "author": "Feed entry author", "content": "Feed entry content", "feed_title": "Feed title", "feed_url": "https://some-website/rss", "id": "1234", "published": "2023-08-04T23:51:18.860567+00:00", "summary": "Feed entry summary", "tags": "Feed entry tags", "title": "Feed entry title", "url": "https://some-website/articles/1234" } ]
- parse_feed(url: str)[source]#
Parse a feed URL.
- Parameters:
url – Feed URL.
- Returns:
[ { "author": "Feed entry author", "content": "Feed entry content", "feed_title": "Feed title", "feed_url": "https://some-website/rss", "id": "1234", "published": "2023-08-04T23:51:18.860567+00:00", "summary": "Feed entry summary", "tags": "Feed entry tags", "title": "Feed entry title", "url": "https://some-website/articles/1234" } ]