|
|
|
@ -1,10 +1,8 @@
|
|
|
|
|
from webbrowser import get
|
|
|
|
|
|
|
|
|
|
from click import style
|
|
|
|
|
from utils.console import print_markdown, print_step, print_substep
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
import os, random, praw, re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_subreddit_threads():
|
|
|
|
|
global submission
|
|
|
|
|
"""
|
|
|
|
@ -13,7 +11,6 @@ def get_subreddit_threads():
|
|
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if os.getenv("REDDIT_2FA", default="no").casefold() == "yes":
|
|
|
|
|
print(
|
|
|
|
|
"\nEnter your two-factor authentication code from your authenticator app.\n"
|
|
|
|
@ -48,7 +45,11 @@ def get_subreddit_threads():
|
|
|
|
|
# ! Prompt the user to enter a subreddit
|
|
|
|
|
try:
|
|
|
|
|
subreddit = reddit.subreddit(
|
|
|
|
|
re.sub(r"r\/", "", input("What subreddit would you like to pull from? "))
|
|
|
|
|
re.sub(
|
|
|
|
|
r"r\/",
|
|
|
|
|
"",
|
|
|
|
|
input("What subreddit would you like to pull from? "),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
except ValueError:
|
|
|
|
|
subreddit = reddit.subreddit("askreddit")
|
|
|
|
@ -64,14 +65,14 @@ def get_subreddit_threads():
|
|
|
|
|
content["comments"] = []
|
|
|
|
|
|
|
|
|
|
for top_level_comment in submission.comments:
|
|
|
|
|
if not top_level_comment.stickied:
|
|
|
|
|
content["comments"].append(
|
|
|
|
|
{
|
|
|
|
|
"comment_body": top_level_comment.body,
|
|
|
|
|
"comment_url": top_level_comment.permalink,
|
|
|
|
|
"comment_id": top_level_comment.id,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if not top_level_comment.stickied:
|
|
|
|
|
content["comments"].append(
|
|
|
|
|
{
|
|
|
|
|
"comment_body": top_level_comment.body,
|
|
|
|
|
"comment_url": top_level_comment.permalink,
|
|
|
|
|
"comment_id": top_level_comment.id,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
except AttributeError as e:
|
|
|
|
|
pass
|
|
|
|
|