scan feeds from file

This commit is contained in:
Gaël Honorez
2024-01-02 14:05:10 +01:00
parent ef414db31f
commit 2db0a6543f

View File

@@ -103,6 +103,15 @@ class SubStackTask:
LOG.info("Running daily task : " + str(title_post)) LOG.info("Running daily task : " + str(title_post))
ff = r'/data/feeds.txt'
self.feeds = []
with open(ff) as file:
lines = [line.rstrip() for line in file]
for line in lines:
youtube = "youtube" in line
self.feeds.append(RSSfeed(line, youtube))
sub_stack_post = Post( sub_stack_post = Post(
title=title_post, title=title_post,
subtitle="", subtitle="",
@@ -117,7 +126,7 @@ class SubStackTask:
all_news_posts = [] all_news_posts = []
for feed in self.feeds: for feed in self.feeds:
LOG.info("Scanning feed " + feed.url)
html_text = requests.get(feed.url).text html_text = requests.get(feed.url).text
newsFeed = feedparser.parse(html_text) newsFeed = feedparser.parse(html_text)
@@ -200,16 +209,13 @@ async def main(login, password, account):
feeds = [] feeds = []
feeds.append(RSSfeed("https://www.factornews.com/rss.xml")) ff = r'/data/feeds.txt'
feeds.append(RSSfeed("https://nofrag.com/feed")) with open(ff) as file:
feeds.append(RSSfeed("https://dystopeek.fr/feed/")) lines = [line.rstrip() for line in file]
feeds.append(RSSfeed("https://thepixelpost.com/rss/"))
feeds.append(RSSfeed("https://yamukass.substack.com/feed")) for line in lines:
feeds.append(RSSfeed("https://tseret.com/categorie/tests/feed")) youtube = "youtube" in line
feeds.append(RSSfeed("https://www.gamesidestory.com/feed")) feeds.append(RSSfeed(line, youtube))
feeds.append(RSSfeed("https://www.nintendo-town.fr/feed"))
feeds.append(RSSfeed("https://www.youtube.com/feeds/videos.xml?channel_id=UC-OvBDfZGn1OdsqMBwkOI_A", True))
feeds.append(RSSfeed("https://www.youtube.com/feeds/videos.xml?playlist_id=PLZRiqJjIUlDTrwYs_UqEIts5fVaBpaIEz", True))
task = SubStackTask(login, password, account, feeds) task = SubStackTask(login, password, account, feeds)