You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RedditVideoMakerBot/utils/subreddit.py

22 lines
730 B

from typing import List
import json
def get_subreddit_undone(submissions: List, subreddit):
"""
recursively checks if the top submission in the list was already done.
"""
with open("./video_creation/data/videos.json", "r") as done_vids_raw:
done_videos = json.load(done_vids_raw)
for submission in submissions:
if already_done(done_videos, submission):
continue
return submission
return get_subreddit_undone(subreddit.top(time_filter="hour"), subreddit) # all of the videos in hot have already been done
2 years ago
def already_done(done_videos: list, submission):
for video in done_videos:
if video["id"] == str(submission):
return True
return False