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:
parent
f961b71992
commit
c9feafe9e4
6
main.py
6
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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue