pull/334/merge
Riccardo Benedetti 3 years ago committed by GitHub
commit 24e5bd993d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,5 +16,8 @@ THEME=""
# Enter a subreddit, e.g. "AskReddit" # Enter a subreddit, e.g. "AskReddit"
SUBREDDIT="" SUBREDDIT=""
# Max reddit comments length in characters e.g. "100"
MAX_COMMENT_LEN="100"
# Range is 0 -> 1 # Range is 0 -> 1
OPACITY="0.9" OPACITY="0.9"

@ -23,6 +23,7 @@ REQUIRED_VALUES = [
"REDDIT_USERNAME", "REDDIT_USERNAME",
"REDDIT_PASSWORD", "REDDIT_PASSWORD",
"OPACITY", "OPACITY",
"MAX_COMMENT_LEN",
] ]

@ -1,3 +1,4 @@
from email.mime import base
from rich.console import Console from rich.console import Console
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
@ -67,13 +68,14 @@ def get_subreddit_threads():
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( if len(top_level_comment.body) <= int(os.getenv("MAX_COMMENT_LEN")):
{ content["comments"].append(
"comment_body": top_level_comment.body, {
"comment_url": top_level_comment.permalink, "comment_body": top_level_comment.body,
"comment_id": top_level_comment.id, "comment_url": top_level_comment.permalink,
} "comment_id": top_level_comment.id,
) }
)
except AttributeError as e: except AttributeError as e:
pass pass

Loading…
Cancel
Save