genai-rss-space / rss_reader.py
8shanrahan2
Initial commit πŸš€
42b5a1a
raw
history blame
632 Bytes
import feedparser
from newspaper import Article
def fetch_articles(rss_urls, limit=3):
articles = []
for url in rss_urls:
feed = feedparser.parse(url)
for entry in feed.entries[:limit]:
try:
article = Article(entry.link)
article.download()
article.parse()
articles.append({
"title": entry.title,
"link": entry.link,
"text": article.text,
"published": entry.published
})
except:
continue
return articles