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