adding logs

This commit is contained in:
Gaël Honorez
2024-01-01 19:10:05 +01:00
parent fc134bacb0
commit be8d49415f

View File

@@ -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}]}]})
@@ -198,12 +198,9 @@ async def main(login, password, account):
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()