@boy-offi9-inc/tidepull 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/pipeline.js +7 -2
- package/package.json +2 -2
package/dist/core/pipeline.js
CHANGED
|
@@ -21,6 +21,7 @@ export async function resolveUrl(rawUrl, ctx) {
|
|
|
21
21
|
const candidates = ctx.extractors.filter((e) => e.suitable(url));
|
|
22
22
|
if (candidates.length === 0)
|
|
23
23
|
throw codedError("UNSUPPORTED", `No extractor can handle ${url.href}`, "Check the URL, or install a plugin for this site (tidepull plugins)");
|
|
24
|
+
let primaryErr;
|
|
24
25
|
let lastErr;
|
|
25
26
|
for (const ex of candidates) {
|
|
26
27
|
ctx.emit({ type: "extract", extractor: ex.name, url: url.href });
|
|
@@ -31,6 +32,8 @@ export async function resolveUrl(rawUrl, ctx) {
|
|
|
31
32
|
catch (e) {
|
|
32
33
|
if (ctx.signal?.aborted)
|
|
33
34
|
throw e;
|
|
35
|
+
if (primaryErr === undefined)
|
|
36
|
+
primaryErr = e;
|
|
34
37
|
lastErr = e;
|
|
35
38
|
ctx.log.debug(`extractor "${ex.name}" failed: ${e instanceof Error ? e.message : String(e)} — trying next candidate`);
|
|
36
39
|
continue;
|
|
@@ -43,8 +46,10 @@ export async function resolveUrl(rawUrl, ctx) {
|
|
|
43
46
|
throw new TidepullError(`Extractor "${ex.name}" returned no formats`);
|
|
44
47
|
return result;
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
const codedOf = (e) => e instanceof TidepullError && typeof e.code === "string" ? e : undefined;
|
|
50
|
+
const chosen = codedOf(primaryErr) ?? codedOf(lastErr) ?? primaryErr ?? lastErr;
|
|
51
|
+
if (chosen instanceof TidepullError)
|
|
52
|
+
throw chosen;
|
|
48
53
|
throw new TidepullError(`All ${candidates.length} matching extractor(s) failed for ${url.href}: ${errMsg(lastErr)}`);
|
|
49
54
|
}
|
|
50
55
|
export async function extractInfo(rawUrl, ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boy-offi9-inc/tidepull",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "A minimal, from-scratch media downloader library: extractor plugins, yt-dlp-style format selection, resumable downloads.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node scripts/fix-dts.mjs",
|
|
26
26
|
"prepack": "npm run build",
|
|
27
27
|
"prepublishOnly": "npm run typecheck && npm test",
|
|
28
|
-
"size": "node scripts/size.mjs dist/index.js --budget=
|
|
28
|
+
"size": "node scripts/size.mjs dist/index.js --budget=58",
|
|
29
29
|
"lint:imports": "node scripts/lint-imports.mjs"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|