Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/tools/test_stock_source_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ def test_unsplash_helpers_preserve_query_params():
# defects rather than encoded as expected behavior. `strict=True` means
# the suite fails the moment one of them is fixed and left in this map.
_STILL_SWALLOWS_TRANSPORT_ERRORS = {
"archive_org": "#511 follow-up: query cascade continues past a failed strategy",
"wikimedia": "#511 follow-up: query cascade continues past a failed strategy",
"pond5_pd": "#511 follow-up: API failure falls through to the web fallback",
}

Expand Down
16 changes: 5 additions & 11 deletions tools/video/stock_sources/archive_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,9 @@ def search(self, query: str, filters: SearchFilters) -> list[Candidate]:
("output", "json"),
]

try:
r = requests.get(_SEARCH_URL, params=params, timeout=30)
r.raise_for_status()
data = r.json()
except Exception:
# One strategy's network/parse error shouldn't kill the
# whole cascade — try the next one.
continue
r = requests.get(_SEARCH_URL, params=params, timeout=30)
r.raise_for_status()
data = r.json()
docs = (data.get("response") or {}).get("docs", []) or []
if not docs:
continue
Expand Down Expand Up @@ -328,9 +323,8 @@ def _hydrate_candidate(
meta = r.json()
except Exception:
# Swallow per-item fetch failures — one bad item shouldn't
# poison the whole search. Alternative would be to raise and
# have corpus_builder catch per-source, but at this layer we
# can keep going.
# poison the whole search. Search-level failures above still
# propagate so corpus_builder can report a broken source.
return None

files = meta.get("files") or []
Expand Down
19 changes: 8 additions & 11 deletions tools/video/stock_sources/wikimedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,14 @@ def search(self, query: str, filters: SearchFilters) -> list[Candidate]:
"inprop": "url",
}

try:
r = requests.get(
_API_URL,
params=params,
headers={"User-Agent": _USER_AGENT},
timeout=30,
)
r.raise_for_status()
data = r.json()
except Exception:
continue
r = requests.get(
_API_URL,
params=params,
headers={"User-Agent": _USER_AGENT},
timeout=30,
)
r.raise_for_status()
data = r.json()
pages = list(((data.get("query") or {}).get("pages") or {}).values())
if not pages:
continue
Expand Down
Loading