fix(downloads): a site the downloader no longer understands says so, and offers a retry
yt-dlp asks for a bug report on an extraction failure it did not expect: the site answered in a way its extractor does not read (measured on a TikTok link: fails on every attempt under yt-dlp 2026.07.04, downloads under 2026.08.19). That failure read as "Something went wrong" with no retry; it is now its own category, site_changed, with a Retry in the failure window. A contract test holds every failure category to its copy in both languages.
This commit is contained in:
@@ -86,6 +86,18 @@ const failDetails = [
|
||||
...new Set([...backend("downloads/errors.py").matchAll(/detail="([\w.]+)"/g)].map((m) => m[1]!)),
|
||||
];
|
||||
const DETAIL = "downloads.errors.fail.catalog.";
|
||||
// Every category `classify` / the catalog can give a failure → `downloads.errors.fail.cat.<code>`. A
|
||||
// category without copy never fails loudly: the row falls back to the "unknown" sentence.
|
||||
const failCategories = [
|
||||
...new Set([
|
||||
...[
|
||||
...(backend("downloads/errors.py").split("_RULES: tuple")[1] ?? "")
|
||||
.split("\n)\n")[0]!
|
||||
.matchAll(/,\s*"(\w+)"\),/g),
|
||||
].map((m) => m[1]!),
|
||||
...[...backend("downloads/errors.py").matchAll(/code="(\w+)"/g)].map((m) => m[1]!),
|
||||
]),
|
||||
];
|
||||
|
||||
// What a structured 404 says is gone → `errors.notFound.<what>`: every `not_found("x")` and every
|
||||
// `owned_or_404(..., what="x")` / `get_or_404(..., what="x")` under routes/, read from the sources.
|
||||
@@ -317,6 +329,18 @@ describe("backend ids have their names in both languages", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it(`${lang}: every download failure category`, () => {
|
||||
expect(failCategories.length).toBeGreaterThan(5);
|
||||
expect(
|
||||
missing(
|
||||
failCategories.flatMap((c) => [
|
||||
`downloads.errors.fail.cat.${c}.short`,
|
||||
`downloads.errors.fail.cat.${c}.body`,
|
||||
]),
|
||||
),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it(`${lang}: every download failure-catalog entry`, () => {
|
||||
expect(
|
||||
missing(failDetails.flatMap((d) => [`${DETAIL}${d}.short`, `${DETAIL}${d}.body`])),
|
||||
|
||||
@@ -294,6 +294,10 @@
|
||||
"short": "Source unavailable",
|
||||
"body": "The original download this clip is based on is no longer available."
|
||||
},
|
||||
"site_changed": {
|
||||
"short": "The site has changed",
|
||||
"body": "The site answered in a way the downloader doesn't understand yet – it has probably changed. An update of the downloader on the server usually fixes this, so try again later."
|
||||
},
|
||||
"network": {
|
||||
"short": "Network error",
|
||||
"body": "A network error interrupted the download. A retry usually fixes this."
|
||||
|
||||
@@ -294,6 +294,10 @@
|
||||
"short": "A forrás nem elérhető",
|
||||
"body": "Az eredeti letöltés, amelyből ez a vágás készült, már nem érhető el."
|
||||
},
|
||||
"site_changed": {
|
||||
"short": "Az oldal megváltozott",
|
||||
"body": "Az oldal olyan választ adott, amit a letöltő még nem ért – valószínűleg megváltozott. Ezt általában a szerveren futó letöltő frissítése javítja, ezért próbáld újra később."
|
||||
},
|
||||
"network": {
|
||||
"short": "Hálózati hiba",
|
||||
"body": "Hálózati hiba szakította meg a letöltést. Újrapróbálásra általában megjavul."
|
||||
|
||||
Reference in New Issue
Block a user