Files
TheOracle/rss-feed-notif/rss-feed.py
2025-08-30 22:32:21 -05:00

24 lines
714 B
Python

from typing import List
import feedparser
import tomllib
import json
with open("config.toml","rb") as file:
config = tomllib.load(file)
print(config)
previous_msgs = set()
def read_rss_feeds(client):
for feed_name,feed_link in config["rss-feeds"].items():
feed = feedparser.parse(feed_link)
for feed_post in feed.entries:
if feed_post.title in previous_msgs:
continue
else:
previous_msgs.add(feed_post.title)
notif_json = {"title":feed_post.title,"body":feed_post.description,"topic":"overlordian-news-192","link":feed_post.link}
client.publish("notification-pusher",json.dumps(notif_json),0)