adding logs
This commit is contained in:
@@ -77,7 +77,7 @@ class SubStackTask:
|
|||||||
# Calculate the time until 6 AM next day
|
# Calculate the time until 6 AM next day
|
||||||
next_run = (now + datetime.timedelta(days=1)).replace(hour=6, minute=5, second=0, microsecond=0)
|
next_run = (now + datetime.timedelta(days=1)).replace(hour=6, minute=5, second=0, microsecond=0)
|
||||||
sleep_seconds = (next_run - now).total_seconds()
|
sleep_seconds = (next_run - now).total_seconds()
|
||||||
|
LOG.info("Waiting for " + str(sleep_seconds) + " seconds for next scan")
|
||||||
# Wait until the next run time
|
# Wait until the next run time
|
||||||
await asyncio.sleep(sleep_seconds)
|
await asyncio.sleep(sleep_seconds)
|
||||||
|
|
||||||
@@ -105,7 +105,6 @@ class SubStackTask:
|
|||||||
|
|
||||||
for feed in self.feeds:
|
for feed in self.feeds:
|
||||||
|
|
||||||
print(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)
|
||||||
|
|
||||||
@@ -126,6 +125,8 @@ class SubStackTask:
|
|||||||
title = post["title"]
|
title = post["title"]
|
||||||
ftext = ""
|
ftext = ""
|
||||||
|
|
||||||
|
LOG.info("Posting " + str(title))
|
||||||
|
|
||||||
if "summary" in post:
|
if "summary" in post:
|
||||||
ftext = html.unescape(post["summary"])
|
ftext = html.unescape(post["summary"])
|
||||||
# Using regular expressions to remove HTML tags
|
# Using regular expressions to remove HTML tags
|
||||||
@@ -136,7 +137,6 @@ class SubStackTask:
|
|||||||
if "yt_videoid" in post:
|
if "yt_videoid" in post:
|
||||||
sub_stack_post.add({"type":"heading", "level":3, "content": title})
|
sub_stack_post.add({"type":"heading", "level":3, "content": title})
|
||||||
videoId = post["yt_videoid"]
|
videoId = post["yt_videoid"]
|
||||||
print(videoId)
|
|
||||||
sub_stack_post.add({"type":"youtube2", "src": videoId })
|
sub_stack_post.add({"type":"youtube2", "src": videoId })
|
||||||
sub_stack_post.add({'type': 'paragraph', 'content': [
|
sub_stack_post.add({'type': 'paragraph', 'content': [
|
||||||
{'content': linkURL, 'marks': [{'type': "link", 'href': linkURL}]}]})
|
{'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?channel_id=UC-OvBDfZGn1OdsqMBwkOI_A", True))
|
||||||
feeds.append(RSSfeed("https://www.youtube.com/feeds/videos.xml?playlist_id=PLZRiqJjIUlDTrwYs_UqEIts5fVaBpaIEz", 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)
|
||||||
|
|
||||||
|
LOG.info("Starting bot")
|
||||||
await task.run_daily_at_6_am()
|
await task.run_daily_at_6_am()
|
||||||
#await task.daily_task()
|
#await task.daily_task()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user