Skip to content

Commit 48402d9

Browse files
author
OpenMontage Review
committed
Merge reviewed stock cohort member PR OpenMontageInc#652
# Conflicts: # tests/tools/test_stock_source_adapters.py
2 parents ec6203c + 9d79887 commit 48402d9

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

‎tools/video/stock_sources/archive_org.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,9 @@ def search(self, query: str, filters: SearchFilters) -> list[Candidate]:
157157
("output", "json"),
158158
]
159159

160-
try:
161-
r = requests.get(_SEARCH_URL, params=params, timeout=30)
162-
r.raise_for_status()
163-
data = r.json()
164-
except Exception:
165-
# One strategy's network/parse error shouldn't kill the
166-
# whole cascade — try the next one.
167-
continue
160+
r = requests.get(_SEARCH_URL, params=params, timeout=30)
161+
r.raise_for_status()
162+
data = r.json()
168163
docs = (data.get("response") or {}).get("docs", []) or []
169164
if not docs:
170165
continue
@@ -328,9 +323,8 @@ def _hydrate_candidate(
328323
meta = r.json()
329324
except Exception:
330325
# Swallow per-item fetch failures — one bad item shouldn't
331-
# poison the whole search. Alternative would be to raise and
332-
# have corpus_builder catch per-source, but at this layer we
333-
# can keep going.
326+
# poison the whole search. Search-level failures above still
327+
# propagate so corpus_builder can report a broken source.
334328
return None
335329

336330
files = meta.get("files") or []

‎tools/video/stock_sources/wikimedia.py‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,14 @@ def search(self, query: str, filters: SearchFilters) -> list[Candidate]:
8282
"inprop": "url",
8383
}
8484

85-
try:
86-
r = requests.get(
87-
_API_URL,
88-
params=params,
89-
headers={"User-Agent": _USER_AGENT},
90-
timeout=30,
91-
)
92-
r.raise_for_status()
93-
data = r.json()
94-
except Exception:
95-
continue
85+
r = requests.get(
86+
_API_URL,
87+
params=params,
88+
headers={"User-Agent": _USER_AGENT},
89+
timeout=30,
90+
)
91+
r.raise_for_status()
92+
data = r.json()
9693
pages = list(((data.get("query") or {}).get("pages") or {}).values())
9794
if not pages:
9895
continue

0 commit comments

Comments
 (0)