@ -7,6 +7,8 @@ from utils.subreddit import get_subreddit_undone
from utils . videos import check_done
from utils . videos import check_done
from praw . models import MoreComments
from praw . models import MoreComments
import re
TEXT_WHITELIST = set ( " abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 " )
TEXT_WHITELIST = set ( " abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 " )
@ -45,11 +47,17 @@ def get_subreddit_threads():
if not getenv (
if not getenv (
" SUBREDDIT "
" SUBREDDIT "
) : # note to self. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython")
) : # note to self. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython")
try :
subreddit = reddit . subreddit (
subreddit = reddit . subreddit (
input ( " What subreddit would you like to pull from? " )
re . sub ( r " r \ / " , " " , input ( " What subreddit would you like to pull from? " ) )
) # if the env isnt set, ask user
)
except ValueError :
subreddit = reddit . subreddit ( " askreddit " )
print_substep ( " Subreddit not defined. Using AskReddit. " )
else :
else :
print_substep ( f " Using subreddit: r/ { getenv ( ' SUBREDDIT ' ) } from environment variable config " )
print_substep (
f " Using subreddit: r/ { getenv ( ' SUBREDDIT ' ) } from environment variable config "
)
subreddit = reddit . subreddit (
subreddit = reddit . subreddit (
getenv ( " SUBREDDIT " )
getenv ( " SUBREDDIT " )
) # Allows you to specify in .env. Done for automation purposes.
) # Allows you to specify in .env. Done for automation purposes.