mcp-youtube-intelligence 0.2.3 → 0.2.4
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/README.md +6 -1
- package/build/analyze_channel.js +36 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,12 @@ Add to your Claude Desktop / MCP client config:
|
|
|
60
60
|
**`analyze_channel`** — Extract intelligence from a YouTube channel
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
-
channel_url: YouTube channel URL or @handle
|
|
63
|
+
channel_url: YouTube channel URL or @handle. Accepts:
|
|
64
|
+
- @handle (e.g. @fireship)
|
|
65
|
+
- full URL with handle (e.g. youtube.com/@fireship)
|
|
66
|
+
- /channel/UC... URL
|
|
67
|
+
- bare 24-character UC... channel ID
|
|
68
|
+
- legacy /c/name or /user/name URL
|
|
64
69
|
max_videos: Number of recent videos to analyze (default: 5, max: 50)
|
|
65
70
|
```
|
|
66
71
|
|
package/build/analyze_channel.js
CHANGED
|
@@ -130,7 +130,23 @@ export async function resolveChannel(input, apiKey) {
|
|
|
130
130
|
else {
|
|
131
131
|
// custom_url — fall back to search (costs 100 quota units); rare path
|
|
132
132
|
const searchUrl = `${YT_API_BASE}/search?part=snippet&type=channel&q=${encodeURIComponent(parsed.value)}&maxResults=1&key=${apiKey}`;
|
|
133
|
-
|
|
133
|
+
// Same one-shot tolerance as the channels-API lookup below: a thrown rejection
|
|
134
|
+
// is as transient as a 5xx, and this path previously had neither — leaving the
|
|
135
|
+
// most quota-expensive of the three call sites the least tolerant of a blip.
|
|
136
|
+
const fetchSearch = () => fetchWithTimeout(searchUrl, {}, "YouTube search API");
|
|
137
|
+
let searchResp;
|
|
138
|
+
try {
|
|
139
|
+
searchResp = await fetchSearch();
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
searchResp = undefined;
|
|
143
|
+
}
|
|
144
|
+
if (searchResp === undefined) {
|
|
145
|
+
searchResp = await fetchSearch();
|
|
146
|
+
}
|
|
147
|
+
else if (!searchResp.ok && searchResp.status >= 500) {
|
|
148
|
+
searchResp = await fetchSearch();
|
|
149
|
+
}
|
|
134
150
|
if (!searchResp.ok)
|
|
135
151
|
throw new Error(`YouTube search API error ${searchResp.status}: ${await searchResp.text()}`);
|
|
136
152
|
const searchData = await parseJsonResponse(searchResp, "YouTube search API");
|
|
@@ -193,7 +209,25 @@ export async function getRecentVideoIds(uploadsPlaylistId, maxResults, apiKey) {
|
|
|
193
209
|
`&playlistId=${encodeURIComponent(uploadsPlaylistId)}` +
|
|
194
210
|
`&maxResults=${maxResults}` +
|
|
195
211
|
`&key=${apiKey}`;
|
|
196
|
-
|
|
212
|
+
// Same one-shot tolerance as resolveChannel's channels-API lookup and the Apify
|
|
213
|
+
// calls: a thrown rejection (connection reset, DNS blip) is as transient as a
|
|
214
|
+
// 5xx. This is the second external call every analyze_channel run makes, and
|
|
215
|
+
// previously it had no tolerance at all — a single blip failed the whole tool
|
|
216
|
+
// call immediately.
|
|
217
|
+
const fetchPlaylistItems = () => fetchWithTimeout(apiUrl, {}, "YouTube playlistItems API");
|
|
218
|
+
let resp;
|
|
219
|
+
try {
|
|
220
|
+
resp = await fetchPlaylistItems();
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
resp = undefined;
|
|
224
|
+
}
|
|
225
|
+
if (resp === undefined) {
|
|
226
|
+
resp = await fetchPlaylistItems();
|
|
227
|
+
}
|
|
228
|
+
else if (!resp.ok && resp.status >= 500) {
|
|
229
|
+
resp = await fetchPlaylistItems();
|
|
230
|
+
}
|
|
197
231
|
if (!resp.ok)
|
|
198
232
|
throw new Error(`YouTube playlistItems API error ${resp.status}: ${await resp.text()}`);
|
|
199
233
|
const data = await parseJsonResponse(resp, "YouTube playlistItems API");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-youtube-intelligence",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|