AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
feat: honor EXCLUDE_SOURCES env var in source count + pipeline filter
Tobi4f6b86c45699
diff --git a/hooks/scripts/check-config.sh b/hooks/scripts/check-config.shindex 39b4bbdc..81da6d23 100755--- a/hooks/scripts/check-config.sh+++ b/hooks/scripts/check-config.sh@@ -97,7 +97,16 @@ if [[ -n "$HAS_BSKY" ]]; thenSOURCE_COUNT=$((SOURCE_COUNT + 1))fiif [[ -n "$HAS_SCRAPECREATORS" ]]; then- SOURCE_COUNT=$((SOURCE_COUNT + 3)) # Reddit comments + TikTok + Instagram+ # Start with Reddit comments + TikTok + Instagram, subtract any in EXCLUDE_SOURCES+ SC_ADD=3+ EXCLUDED="${ENV_EXCLUDE_SOURCES:-${EXCLUDE_SOURCES:-}}"+ if [[ ",$EXCLUDED," == *",tiktok,"* ]]; then+ SC_ADD=$((SC_ADD - 1))+ fi+ if [[ ",$EXCLUDED," == *",instagram,"* ]]; then+ SC_ADD=$((SC_ADD - 1))+ fi+ SOURCE_COUNT=$((SOURCE_COUNT + SC_ADD))fiif [[ -n "$HAS_SCRAPECREATORS" ]]; thendiff --git a/skills/last30days/scripts/lib/pipeline.py b/skills/last30days/scripts/lib/pipeline.pyindex ebedd458..30bcbbf6 100644--- a/skills/last30days/scripts/lib/pipeline.py+++ b/skills/last30days/scripts/lib/pipeline.py@@ -128,6 +128,9 @@ def available_sources(config: dict[str, Any], requested_sources: list[str] | Nonavailable.append("pinterest")if env.is_xquik_available(config):available.append("xquik")+ exclude = {s.strip().lower() for s in (config.get("EXCLUDE_SOURCES") or "").split(",") if s.strip()}+ if exclude:+ available = [s for s in available if s not in exclude]return availablediff --git a/tests/test_pipeline_v3.py b/tests/test_pipeline_v3.pyindex 08b6109b..54dcc182 100644--- a/tests/test_pipeline_v3.py+++ b/tests/test_pipeline_v3.py@@ -904,5 +904,57 @@ class TestZeroKeyPipelineRun(unittest.TestCase):self.assertEqual("fallback-local-score", candidate.explanation)+class TestExcludeSources(unittest.TestCase):+ """EXCLUDE_SOURCES env var filters sources out of available_sources().++ The existing INCLUDE_SOURCES allowlist (used by Perplexity opt-in) does+ not cover this case — tiktok and instagram are added unconditionally+ when SCRAPECREATORS_API_KEY is set, with no way to opt out short of+ unsetting the key. EXCLUDE_SOURCES gives runs a per-invocation denylist.+ """++ def test_excludes_tiktok_and_instagram(self):+ config = {+ "SCRAPECREATORS_API_KEY": "test-key",+ "EXCLUDE_SOURCES": "tiktok,instagram",+ }+ sources = pipeline.available_sources(config)+ self.assertNotIn("tiktok", sources)+ self.assertNotIn("instagram", sources)+ self.assertIn("reddit", sources)+ self.assertIn("hackernews", sources)++ def test_no_exclusion_when_unset(self):+ config = {"SCRAPECREATORS_API_KEY": "test-key"}+ sources = pipeline.available_sources(config)+ self.assertIn("tiktok", sources)+ self.assertIn("instagram", sources)++ def test_empty_exclude_sources_is_noop(self):+ config = {+ "SCRAPECREATORS_API_KEY": "test-key",+ "EXCLUDE_SOURCES": "",+ }+ sources = pipeline.available_sources(config)+ self.assertIn("tiktok", sources)+ self.assertIn("instagram", sources)++ def test_whitespace_and_case_insensitive(self):+ config = {+ "SCRAPECREATORS_API_KEY": "test-key",+ "EXCLUDE_SOURCES": " TikTok , INSTAGRAM ",+ }+ sources = pipeline.available_sources(config)+ self.assertNotIn("tiktok", sources)+ self.assertNotIn("instagram", sources)++ def test_excludes_non_scrapecreators_source(self):+ """EXCLUDE_SOURCES applies to any source, not just SC-backed ones."""+ config = {"EXCLUDE_SOURCES": "hackernews"}+ sources = pipeline.available_sources(config)+ self.assertNotIn("hackernews", sources)+ self.assertIn("reddit", sources)++if __name__ == "__main__":unittest.main()