Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: explain canonical Wayback replay capture URLs (#7662)

Chanhyo Junga64e951a4ffa
diff --git a/changelog.d/7650.bugfix.md b/changelog.d/7650.bugfix.md
new file mode 100644
index 0000000000..b64a858958
--- /dev/null
+++ b/changelog.d/7650.bugfix.md
@@ -0,0 +1 @@
+Unsupported Wayback replay URLs now explain the exact accepted capture URL format.
diff --git a/src/local_deep_research/web_search_engines/wayback_client.py b/src/local_deep_research/web_search_engines/wayback_client.py
index e83f9996da..ba55d44b5c 100644
--- a/src/local_deep_research/web_search_engines/wayback_client.py
+++ b/src/local_deep_research/web_search_engines/wayback_client.py
@@ -12,6 +12,11 @@ from ..utilities.resource_utils import safe_close
from .rate_limiting import RateLimitError
AVAILABLE_API = "https://archive.org/wayback/available"
+UNSUPPORTED_REPLAY_CAPTURE_URL = (
+ "Unsupported archive replay capture URL. Use the exact capture format "
+ "https://web.archive.org/web/<timestamp>/<url>, where timestamp is 14 "
+ "digits (UTC) and url is the original HTTP(S) URL."
+)
def _archive_target_key(url: str):
@@ -80,10 +85,10 @@ def capture_metadata_from_replay_url(url: str) -> dict | None:
if not any(has_replay_path(path) for path in (parsed.path, prepared.path)):
return None
if prepared_host != "web.archive.org":
- raise ValueError("Unsupported archive replay capture URL")
+ raise ValueError(UNSUPPORTED_REPLAY_CAPTURE_URL)
replay = re.match(r"^/web/([0-9]{14})(?:id_|if_)?/https?://", parsed.path)
if replay is None:
- raise ValueError("Unsupported archive replay capture URL")
+ raise ValueError(UNSUPPORTED_REPLAY_CAPTURE_URL)
timestamp = replay.group(1)
captured_date = datetime.strptime(timestamp, "%Y%m%d%H%M%S")
target = url.split(f"/web/{timestamp}", 1)[1].split("/", 1)[1]
diff --git a/tests/advanced_search_system/tools/test_archive_fetch.py b/tests/advanced_search_system/tools/test_archive_fetch.py
index c6a45442fa..331298f48a 100644
--- a/tests/advanced_search_system/tools/test_archive_fetch.py
+++ b/tests/advanced_search_system/tools/test_archive_fetch.py
@@ -275,6 +275,40 @@ def _assert_source(collector, *, replay=REPLAY, timestamp=CAPTURED):
return source
+ "replay",
+ [
+ pytest.param(
+ "https://archive.org/web/20240203112233/https://example.com/history",
+ id="archive_org_redirector",
+ ),
+ pytest.param(
+ "https://web.archive.org/WEB/20240203112233/https://example.com/history",
+ id="uppercase_web",
+ ),
+ ],
+)
[email protected]("mode", FETCH_MODES[1:])
+def test_unsupported_direct_replay_explains_exact_capture_spelling(
+ replay, mode, runtime
+):
+ collector = SearchResultsCollector([])
+ tool = build_fetch_tool(mode, collector, model=runtime.model)
+
+ output = tool.invoke(_arguments(mode, url=replay))
+
+ assert "Unsupported archive replay capture URL" in output
+ assert "https://web.archive.org/web/<timestamp>/<url>" in output
+ assert "timestamp is 14 digits" in output
+ assert "url is the original HTTP(S) URL" in output
+ assert collector.results == []
+ assert collector.fetch_count == 0
+ runtime.getter.assert_not_called()
+ runtime.factory.assert_not_called()
+ runtime.fetcher.fetch.assert_not_called()
+ runtime.model.invoke.assert_not_called()
+
+
@pytest.mark.parametrize("timestamp", [None, "20240115"])
def test_lookup_uses_fixed_https_api_and_preserves_actual_capture(timestamp):
response = _response()