From c9feafe9e410049959402e6de457430214900e27 Mon Sep 17 00:00:00 2001 From: Marvin Date: Sun, 15 Mar 2026 10:00:20 -0300 Subject: [PATCH] Fix include_comments parameter to respect query value Previously hardcoded to True, now properly uses the endpoint parameter. This allows faster responses when comments are not needed. --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 5654340..cd09d23 100755 --- a/main.py +++ b/main.py @@ -79,13 +79,17 @@ async def scrape_subreddit( - **time_range**: Time filter ('hour', 'day', 'week', 'month', 'year', 'all') - **depth**: Maximum comment nesting depth (1-10) - **include_comments**: Whether to scrape comments (True/False, default: True) + + Returns post data with or without comment threads based on parameter. + Setting `include_comments=false` provides faster response times as it skips + the additional DOM traversal required for comment extraction. """ result = scraper.scrape_subreddit_top( subreddit=subreddit, limit=limit, time_range=time_range, depth=depth, - include_comments=True # Always extract when requested via API + include_comments=include_comments ) if "Error" in result: