RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

Can't Retrieve Random Thread from Specified Subreddit

Open ParkerDaudt opened this issue 4 years ago • 1 comments

After running the program a few times, I've noticed that the random parameter in the config.toml file doesn't actually select a random thread from the subreddit. When comparing with the threads in a given Subreddit, the program is iterating through the Hot posts.

ParkerDaudt avatar Jul 15 '22 00:07 ParkerDaudt

Fixed my own issue. Might not be pretty, but it gets the job done and should still interface with the duplication check function .

Here's the snippet of code that now randomly selects a submission from the subreddit.

Also had to import random at the beginning of the file

else: threads = subreddit.hot(limit=100) # Random submission selection submissionarray = [] for submission in threads: submissionarray.append(submission) if len(submissionarray) > 0: x = random.randrange(0, len(submissionarray), 2) submission = submissionarray[x] # submission = get_subreddit_undone(threads, subreddit) submission = check_done(submission) # double-checking

ParkerDaudt avatar Jul 15 '22 18:07 ParkerDaudt