mcp-youtube-intelligence 0.2.0 → 0.2.2
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/build/analyze_channel.js +28 -6
- package/package.json +2 -2
package/build/analyze_channel.js
CHANGED
|
@@ -196,11 +196,24 @@ export async function runApifyTranscriptScraper(videoUrls, token) {
|
|
|
196
196
|
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
197
197
|
body: JSON.stringify({ urls: videoUrls.map((url) => ({ url })) }),
|
|
198
198
|
}, "Apify start run");
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
|
|
199
|
+
// A rejected promise (connection reset, DNS blip) is exactly as transient as a
|
|
200
|
+
// 5xx response — every status poll below already treats the two identically —
|
|
201
|
+
// but this initial call let a rejection escape uncaught, failing the whole tool
|
|
202
|
+
// call immediately instead of getting the same one-shot retry.
|
|
203
|
+
let runResp;
|
|
204
|
+
try {
|
|
205
|
+
runResp = await startRun();
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
runResp = undefined;
|
|
209
|
+
}
|
|
210
|
+
if (runResp === undefined) {
|
|
211
|
+
runResp = await startRun();
|
|
212
|
+
}
|
|
213
|
+
else if (!runResp.ok && runResp.status >= 500) {
|
|
214
|
+
// Retry once on a transient 5xx — the same one-shot tolerance given above to a
|
|
215
|
+
// thrown network error; a 503 here previously failed the whole tool call
|
|
216
|
+
// immediately instead of getting that same retry.
|
|
204
217
|
runResp = await startRun();
|
|
205
218
|
}
|
|
206
219
|
if (!runResp.ok) {
|
|
@@ -387,7 +400,16 @@ ${truncated}`;
|
|
|
387
400
|
}, "Gemini API");
|
|
388
401
|
}
|
|
389
402
|
if (!resp.ok) {
|
|
390
|
-
|
|
403
|
+
const detail = await resp.text();
|
|
404
|
+
if (resp.status === 401 || resp.status === 403) {
|
|
405
|
+
// Auth failures are invariant across requests using the same key — every
|
|
406
|
+
// remaining video would fail identically, so stop instead of repeating a
|
|
407
|
+
// doomed call up to max_videos times.
|
|
408
|
+
lastRequestError = `Gemini API error ${resp.status}: ${detail}`;
|
|
409
|
+
console.warn(`[analyze_channel] Gemini authentication failed (${resp.status}), aborting remaining videos: ${lastRequestError}`);
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
throw new Error(`Gemini API error ${resp.status}: ${detail}`);
|
|
391
413
|
}
|
|
392
414
|
const body = await parseJsonResponse(resp, "Gemini API");
|
|
393
415
|
const text = body.candidates?.[0]?.content?.parts?.[0]?.text ?? "{}";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-youtube-intelligence",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "MCP server for extracting structured intelligence from YouTube channels and videos — transcripts, topics, competitive signals",
|
|
5
5
|
"mcpName": "io.github.dmitriusan/mcp-youtube-intelligence",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^22.0.0",
|
|
55
55
|
"typescript": "^5.0.0",
|
|
56
|
-
"vitest": "^
|
|
56
|
+
"vitest": "^4.1.11"
|
|
57
57
|
}
|
|
58
58
|
}
|