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.
This commit is contained in:
Marvin 2026-03-15 10:00:20 -03:00
parent f961b71992
commit c9feafe9e4
1 changed files with 5 additions and 1 deletions

View File

@ -79,13 +79,17 @@ async def scrape_subreddit(
- **time_range**: Time filter ('hour', 'day', 'week', 'month', 'year', 'all') - **time_range**: Time filter ('hour', 'day', 'week', 'month', 'year', 'all')
- **depth**: Maximum comment nesting depth (1-10) - **depth**: Maximum comment nesting depth (1-10)
- **include_comments**: Whether to scrape comments (True/False, default: True) - **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( result = scraper.scrape_subreddit_top(
subreddit=subreddit, subreddit=subreddit,
limit=limit, limit=limit,
time_range=time_range, time_range=time_range,
depth=depth, depth=depth,
include_comments=True # Always extract when requested via API include_comments=include_comments
) )
if "Error" in result: if "Error" in result: