feat: honor EXCLUDE_SOURCES env var in source count + pipeline filter
Adds a per-run denylist via the existing-but-unused EXCLUDE_SOURCES config key. Two coupled changes: 1. pipeline.available_sources() filters out any source listed in config["EXCLUDE_SOURCES"] (comma-separated, case-insensitive, whitespace-tolerant) before returning. 2. hooks/scripts/check-config.sh "Ready — N sources active" banner subtracts excluded sources from the ScrapeCreators +3 (Reddit comments + TikTok + Instagram) so the count matches what the pipeline actually runs. Use case: skip TikTok/Instagram on runs where you only want text-substantive sources, without unsetting SCRAPECREATORS_API_KEY (which would also kill Reddit comments). The existing INCLUDE_SOURCES allowlist covers Perplexity opt-in but doesn't cover this denylist case — tiktok and instagram are added unconditionally when SCRAPECREATORS_API_KEY is set, with no opt-out short of removing the key. Tests (tests/test_pipeline_v3.py::TestExcludeSources): - excludes tiktok+instagram when listed - no exclusion when env unset or empty string - case-insensitive + whitespace-tolerant parsing - works for any source (e.g. EXCLUDE_SOURCES=hackernews), not just SC-backed
This commit is contained in:
@@ -128,6 +128,9 @@ def available_sources(config: dict[str, Any], requested_sources: list[str] | Non
|
||||
available.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 available
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user