From be8d49415f2867f77a71208db89d70ab557fbeae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Honorez?= Date: Mon, 1 Jan 2024 19:10:05 +0100 Subject: [PATCH] adding logs --- Post_RSS_on_SubStack.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Post_RSS_on_SubStack.py b/Post_RSS_on_SubStack.py index f2d2471..a60859c 100644 --- a/Post_RSS_on_SubStack.py +++ b/Post_RSS_on_SubStack.py @@ -77,7 +77,7 @@ class SubStackTask: # Calculate the time until 6 AM next day next_run = (now + datetime.timedelta(days=1)).replace(hour=6, minute=5, second=0, microsecond=0) sleep_seconds = (next_run - now).total_seconds() - + LOG.info("Waiting for " + str(sleep_seconds) + " seconds for next scan") # Wait until the next run time await asyncio.sleep(sleep_seconds) @@ -105,7 +105,6 @@ class SubStackTask: for feed in self.feeds: - print(feed.url) html_text = requests.get(feed.url).text newsFeed = feedparser.parse(html_text) @@ -126,6 +125,8 @@ class SubStackTask: title = post["title"] ftext = "" + LOG.info("Posting " + str(title)) + if "summary" in post: ftext = html.unescape(post["summary"]) # Using regular expressions to remove HTML tags @@ -136,7 +137,6 @@ class SubStackTask: if "yt_videoid" in post: sub_stack_post.add({"type":"heading", "level":3, "content": title}) videoId = post["yt_videoid"] - print(videoId) sub_stack_post.add({"type":"youtube2", "src": videoId }) sub_stack_post.add({'type': 'paragraph', 'content': [ {'content': linkURL, 'marks': [{'type': "link", 'href': linkURL}]}]}) @@ -197,13 +197,10 @@ async def main(login, password, account): 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) + LOG.info("Starting bot") await task.run_daily_at_6_am() #await task.daily_task()