Skip to content

Commit

Permalink
Raise err if CDX API doesn't respect showDupeCount
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvine committed May 15, 2024
1 parent dca5076 commit 9e896ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions waybackpack/cdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def search(
fields = cdx[0]
snapshots = [dict(zip(fields, row)) for row in cdx[1:]]
if uniques_only:
if len(snapshots) and "dupecount" not in snapshots[0]:
raise WaybackpackException(
"Wayback Machine CDX API not respecting showDupeCount=true; retry without --uniques-only."
)
return [s for s in snapshots if int(s["dupecount"]) == 0]
else:
return snapshots

0 comments on commit 9e896ad

Please sign in to comment.