From 8d1e2a51342cb09ed471a940f09d05a1f9404593 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Sat, 25 Jul 2026 02:55:27 +0530 Subject: [PATCH] feat(reddit-scraper): add support for community-only subreddit scraping without search queries --- .../app/proprietary/platforms/reddit/scraper.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/surfsense_backend/app/proprietary/platforms/reddit/scraper.py b/surfsense_backend/app/proprietary/platforms/reddit/scraper.py index a14e1c13f..bcbab5673 100644 --- a/surfsense_backend/app/proprietary/platforms/reddit/scraper.py +++ b/surfsense_backend/app/proprietary/platforms/reddit/scraper.py @@ -407,6 +407,18 @@ async def iter_reddit( yield item return + # Community-only: a bare subreddit name with no urls/searches. The capability + # schema promises "with no search_queries, its listing is scraped"; without + # this the searches loop below builds zero jobs and yields nothing. Reuse the + # same flow the URL path dispatches for /r/. (searches present => the + # name stays a search scope, handled below.) + if not input_model.searches and input_model.searchCommunityName: + async for item in _subreddit_flow( + input_model.searchCommunityName, input_model=input_model + ): + yield item + return + # Fair-share the item budget across queries: with a shared cap, the # first-finishing (often broadest/noisiest) search would fill the whole # collector limit and starve the precise queries.