import feedparser, requests # L'architecture vient couper le couplage FORT RSS_URL = "https://www.nasa.gov/rss/dyn/breaking_news.rss" SLACK_WEBHOOK = "https://hooks.slack.com/services/your/webhook/url" KEYWORDS = ["NASA", "space", "launch"] def run(): feed = feedparser.parse(RSS_URL) for entry in feed.entries: title = entry.title.lower() matched_keywords = [kw for kw in KEYWORDS if kw.lower() in title] if matched_keywords: message = ( f"**New NASA news**: {entry.title}\n" f"Link: {entry.link}" ) requests.post(SLACK_WEBHOOK, json={"text": message}) print(f"Posted to Slack: {entry.title}") if __name__ == "__main__": run()