scrapebadger 0.15.0 → 0.15.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/README.md +1 -0
- package/dist/index.d.cts +1600 -77
- package/dist/index.d.ts +1600 -77
- package/dist/index.js +619 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +610 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5054,6 +5054,612 @@ var EbayClient = class {
|
|
|
5054
5054
|
}
|
|
5055
5055
|
};
|
|
5056
5056
|
|
|
5057
|
+
// src/youtube/search.ts
|
|
5058
|
+
var SearchClient8 = class {
|
|
5059
|
+
client;
|
|
5060
|
+
constructor(client) {
|
|
5061
|
+
this.client = client;
|
|
5062
|
+
}
|
|
5063
|
+
/**
|
|
5064
|
+
* Search YouTube videos / channels / playlists with the full filter matrix.
|
|
5065
|
+
*
|
|
5066
|
+
* @param params - Search parameters including query, filters, and continuation.
|
|
5067
|
+
* @returns A page of search results with chips, refinements, and a continuation token.
|
|
5068
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
5069
|
+
* @throws ValidationError - If the parameters are invalid.
|
|
5070
|
+
*/
|
|
5071
|
+
async search(params) {
|
|
5072
|
+
return this.client.request("/v1/youtube/search", {
|
|
5073
|
+
params: {
|
|
5074
|
+
query: params.query,
|
|
5075
|
+
type: params.type,
|
|
5076
|
+
sort_by: params.sort_by,
|
|
5077
|
+
upload_date: params.upload_date,
|
|
5078
|
+
duration: params.duration,
|
|
5079
|
+
features: params.features,
|
|
5080
|
+
gl: params.gl,
|
|
5081
|
+
hl: params.hl,
|
|
5082
|
+
continuation: params.continuation
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
/**
|
|
5087
|
+
* Get YouTube keyword autocomplete suggestions.
|
|
5088
|
+
*
|
|
5089
|
+
* @param query - Partial search query prefix.
|
|
5090
|
+
* @param options - Optional region parameters (gl, hl).
|
|
5091
|
+
* @returns Autocomplete suggestions.
|
|
5092
|
+
*/
|
|
5093
|
+
async autocomplete(query, options = {}) {
|
|
5094
|
+
return this.client.request("/v1/youtube/autocomplete", {
|
|
5095
|
+
params: { query, gl: options.gl, hl: options.hl }
|
|
5096
|
+
});
|
|
5097
|
+
}
|
|
5098
|
+
};
|
|
5099
|
+
|
|
5100
|
+
// src/youtube/videos.ts
|
|
5101
|
+
var VideosClient3 = class {
|
|
5102
|
+
client;
|
|
5103
|
+
constructor(client) {
|
|
5104
|
+
this.client = client;
|
|
5105
|
+
}
|
|
5106
|
+
/**
|
|
5107
|
+
* Get a single video's full detail (merged `player` + `next`).
|
|
5108
|
+
*
|
|
5109
|
+
* @param videoId - The YouTube video id.
|
|
5110
|
+
* @param options - Optional region parameters (gl, hl).
|
|
5111
|
+
* @returns Full video detail including engagement, channel, chapters, and heatmap.
|
|
5112
|
+
* @throws NotFoundError - If the video doesn't exist or is unavailable.
|
|
5113
|
+
*/
|
|
5114
|
+
async get(videoId, options = {}) {
|
|
5115
|
+
return this.client.request(`/v1/youtube/videos/${videoId}`, {
|
|
5116
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5117
|
+
});
|
|
5118
|
+
}
|
|
5119
|
+
/**
|
|
5120
|
+
* Get related / recommended videos for a video.
|
|
5121
|
+
*
|
|
5122
|
+
* @param videoId - The YouTube video id.
|
|
5123
|
+
* @param options - Optional region parameters and a continuation token.
|
|
5124
|
+
* @returns Related results with a continuation token.
|
|
5125
|
+
*/
|
|
5126
|
+
async related(videoId, options = {}) {
|
|
5127
|
+
return this.client.request(
|
|
5128
|
+
`/v1/youtube/videos/${videoId}/related`,
|
|
5129
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5130
|
+
);
|
|
5131
|
+
}
|
|
5132
|
+
/**
|
|
5133
|
+
* Get a page of top-level comments for a video.
|
|
5134
|
+
*
|
|
5135
|
+
* @param videoId - The YouTube video id.
|
|
5136
|
+
* @param options - Optional sort order, continuation token, and region.
|
|
5137
|
+
* @returns A page of comments with sorting tokens and a continuation token.
|
|
5138
|
+
*/
|
|
5139
|
+
async comments(videoId, options = {}) {
|
|
5140
|
+
return this.client.request(
|
|
5141
|
+
`/v1/youtube/videos/${videoId}/comments`,
|
|
5142
|
+
{
|
|
5143
|
+
params: {
|
|
5144
|
+
sort_by: options.sort_by,
|
|
5145
|
+
continuation: options.continuation,
|
|
5146
|
+
gl: options.gl,
|
|
5147
|
+
hl: options.hl
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
);
|
|
5151
|
+
}
|
|
5152
|
+
/**
|
|
5153
|
+
* Get a page of replies to a single comment.
|
|
5154
|
+
*
|
|
5155
|
+
* @param videoId - The YouTube video id.
|
|
5156
|
+
* @param commentId - The comment id whose replies to fetch.
|
|
5157
|
+
* @param options - The required replies continuation token plus region.
|
|
5158
|
+
* @returns A page of replies with a continuation token.
|
|
5159
|
+
*/
|
|
5160
|
+
async replies(videoId, commentId, options) {
|
|
5161
|
+
return this.client.request(
|
|
5162
|
+
`/v1/youtube/videos/${videoId}/comments/${commentId}/replies`,
|
|
5163
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5164
|
+
);
|
|
5165
|
+
}
|
|
5166
|
+
/**
|
|
5167
|
+
* Get a video's transcript in the selected language.
|
|
5168
|
+
*
|
|
5169
|
+
* @param videoId - The YouTube video id.
|
|
5170
|
+
* @param options - Optional language and region parameters.
|
|
5171
|
+
* @returns The transcript with timed segments and full text.
|
|
5172
|
+
*/
|
|
5173
|
+
async transcript(videoId, options = {}) {
|
|
5174
|
+
return this.client.request(
|
|
5175
|
+
`/v1/youtube/videos/${videoId}/transcript`,
|
|
5176
|
+
{ params: { language: options.language, gl: options.gl, hl: options.hl } }
|
|
5177
|
+
);
|
|
5178
|
+
}
|
|
5179
|
+
/**
|
|
5180
|
+
* List a video's available caption tracks.
|
|
5181
|
+
*
|
|
5182
|
+
* @param videoId - The YouTube video id.
|
|
5183
|
+
* @param options - Optional region parameters.
|
|
5184
|
+
* @returns The available caption tracks and translation languages.
|
|
5185
|
+
*/
|
|
5186
|
+
async captions(videoId, options = {}) {
|
|
5187
|
+
return this.client.request(
|
|
5188
|
+
`/v1/youtube/videos/${videoId}/captions`,
|
|
5189
|
+
{ params: { gl: options.gl, hl: options.hl } }
|
|
5190
|
+
);
|
|
5191
|
+
}
|
|
5192
|
+
/**
|
|
5193
|
+
* Get a video's stream / format metadata (best-effort; URLs may be PO-token gated).
|
|
5194
|
+
*
|
|
5195
|
+
* @param videoId - The YouTube video id.
|
|
5196
|
+
* @param options - Optional content region and player client.
|
|
5197
|
+
* @returns Streaming metadata with muxed and adaptive formats.
|
|
5198
|
+
*/
|
|
5199
|
+
async streams(videoId, options = {}) {
|
|
5200
|
+
return this.client.request(
|
|
5201
|
+
`/v1/youtube/videos/${videoId}/streams`,
|
|
5202
|
+
{ params: { gl: options.gl, client: options.client } }
|
|
5203
|
+
);
|
|
5204
|
+
}
|
|
5205
|
+
/**
|
|
5206
|
+
* Get a page of live-chat (or chat-replay) messages for a video.
|
|
5207
|
+
*
|
|
5208
|
+
* @param videoId - The YouTube video id.
|
|
5209
|
+
* @param options - Optional continuation token, replay flag, and region.
|
|
5210
|
+
* @returns A page of live-chat messages with a continuation token.
|
|
5211
|
+
*/
|
|
5212
|
+
async liveChat(videoId, options = {}) {
|
|
5213
|
+
return this.client.request(
|
|
5214
|
+
`/v1/youtube/videos/${videoId}/live_chat`,
|
|
5215
|
+
{
|
|
5216
|
+
params: {
|
|
5217
|
+
continuation: options.continuation,
|
|
5218
|
+
replay: options.replay,
|
|
5219
|
+
gl: options.gl,
|
|
5220
|
+
hl: options.hl
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
);
|
|
5224
|
+
}
|
|
5225
|
+
/**
|
|
5226
|
+
* Fetch detail for up to 50 videos concurrently.
|
|
5227
|
+
*
|
|
5228
|
+
* @param params - The video ids (≤50) plus optional region parameters.
|
|
5229
|
+
* @returns Successfully fetched videos plus per-id errors.
|
|
5230
|
+
*/
|
|
5231
|
+
async batch(params) {
|
|
5232
|
+
return this.client.request("/v1/youtube/videos/batch", {
|
|
5233
|
+
method: "POST",
|
|
5234
|
+
body: { video_ids: params.video_ids, gl: params.gl, hl: params.hl }
|
|
5235
|
+
});
|
|
5236
|
+
}
|
|
5237
|
+
async oembed(arg) {
|
|
5238
|
+
const url = typeof arg === "string" ? arg : arg.url;
|
|
5239
|
+
return this.client.request("/v1/youtube/oembed", { params: { url } });
|
|
5240
|
+
}
|
|
5241
|
+
};
|
|
5242
|
+
|
|
5243
|
+
// src/youtube/channels.ts
|
|
5244
|
+
var ChannelsClient = class {
|
|
5245
|
+
client;
|
|
5246
|
+
constructor(client) {
|
|
5247
|
+
this.client = client;
|
|
5248
|
+
}
|
|
5249
|
+
/**
|
|
5250
|
+
* Get full channel detail (accepts a UC id, @handle, or custom URL).
|
|
5251
|
+
*
|
|
5252
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5253
|
+
* @param options - Optional region parameters.
|
|
5254
|
+
* @returns Full channel detail.
|
|
5255
|
+
* @throws NotFoundError - If the channel doesn't exist.
|
|
5256
|
+
*/
|
|
5257
|
+
async get(channelId, options = {}) {
|
|
5258
|
+
return this.client.request(`/v1/youtube/channels/${channelId}`, {
|
|
5259
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5260
|
+
});
|
|
5261
|
+
}
|
|
5262
|
+
/**
|
|
5263
|
+
* Get a page of a channel's long-form videos.
|
|
5264
|
+
*
|
|
5265
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5266
|
+
* @param options - Optional continuation token and region.
|
|
5267
|
+
* @returns A page of video cards with a continuation token.
|
|
5268
|
+
*/
|
|
5269
|
+
async videos(channelId, options = {}) {
|
|
5270
|
+
return this.client.request(
|
|
5271
|
+
`/v1/youtube/channels/${channelId}/videos`,
|
|
5272
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5273
|
+
);
|
|
5274
|
+
}
|
|
5275
|
+
/**
|
|
5276
|
+
* Get a page of a channel's Shorts.
|
|
5277
|
+
*
|
|
5278
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5279
|
+
* @param options - Optional continuation token and region.
|
|
5280
|
+
* @returns A page of Shorts cards with a continuation token.
|
|
5281
|
+
*/
|
|
5282
|
+
async shorts(channelId, options = {}) {
|
|
5283
|
+
return this.client.request(
|
|
5284
|
+
`/v1/youtube/channels/${channelId}/shorts`,
|
|
5285
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5286
|
+
);
|
|
5287
|
+
}
|
|
5288
|
+
/**
|
|
5289
|
+
* Get a page of a channel's live streams.
|
|
5290
|
+
*
|
|
5291
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5292
|
+
* @param options - Optional continuation token and region.
|
|
5293
|
+
* @returns A page of stream cards with a continuation token.
|
|
5294
|
+
*/
|
|
5295
|
+
async streams(channelId, options = {}) {
|
|
5296
|
+
return this.client.request(
|
|
5297
|
+
`/v1/youtube/channels/${channelId}/streams`,
|
|
5298
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5299
|
+
);
|
|
5300
|
+
}
|
|
5301
|
+
/**
|
|
5302
|
+
* Get a page of a channel's playlists.
|
|
5303
|
+
*
|
|
5304
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5305
|
+
* @param options - Optional continuation token and region.
|
|
5306
|
+
* @returns A page of playlist cards with a continuation token.
|
|
5307
|
+
*/
|
|
5308
|
+
async playlists(channelId, options = {}) {
|
|
5309
|
+
return this.client.request(
|
|
5310
|
+
`/v1/youtube/channels/${channelId}/playlists`,
|
|
5311
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5312
|
+
);
|
|
5313
|
+
}
|
|
5314
|
+
/**
|
|
5315
|
+
* Get a page of a channel's community posts.
|
|
5316
|
+
*
|
|
5317
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5318
|
+
* @param options - Optional continuation token and region.
|
|
5319
|
+
* @returns A page of community posts with a continuation token.
|
|
5320
|
+
*/
|
|
5321
|
+
async community(channelId, options = {}) {
|
|
5322
|
+
return this.client.request(
|
|
5323
|
+
`/v1/youtube/channels/${channelId}/community`,
|
|
5324
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5325
|
+
);
|
|
5326
|
+
}
|
|
5327
|
+
/**
|
|
5328
|
+
* Get a channel's lightweight about payload.
|
|
5329
|
+
*
|
|
5330
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5331
|
+
* @param options - Optional region parameters.
|
|
5332
|
+
* @returns The channel about payload.
|
|
5333
|
+
*/
|
|
5334
|
+
async about(channelId, options = {}) {
|
|
5335
|
+
return this.client.request(
|
|
5336
|
+
`/v1/youtube/channels/${channelId}/about`,
|
|
5337
|
+
{ params: { gl: options.gl, hl: options.hl } }
|
|
5338
|
+
);
|
|
5339
|
+
}
|
|
5340
|
+
/**
|
|
5341
|
+
* Get a channel's subscriber count (fast).
|
|
5342
|
+
*
|
|
5343
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5344
|
+
* @param options - Optional region parameters.
|
|
5345
|
+
* @returns The subscriber count.
|
|
5346
|
+
*/
|
|
5347
|
+
async subscriberCount(channelId, options = {}) {
|
|
5348
|
+
return this.client.request(
|
|
5349
|
+
`/v1/youtube/channels/${channelId}/subscriber_count`,
|
|
5350
|
+
{ params: { gl: options.gl, hl: options.hl } }
|
|
5351
|
+
);
|
|
5352
|
+
}
|
|
5353
|
+
/**
|
|
5354
|
+
* Search within a single channel.
|
|
5355
|
+
*
|
|
5356
|
+
* @param channelId - The channel id, @handle, or custom URL.
|
|
5357
|
+
* @param options - The required query plus optional continuation and region.
|
|
5358
|
+
* @returns A page of search results scoped to the channel.
|
|
5359
|
+
*/
|
|
5360
|
+
async search(channelId, options) {
|
|
5361
|
+
return this.client.request(
|
|
5362
|
+
`/v1/youtube/channels/${channelId}/search`,
|
|
5363
|
+
{
|
|
5364
|
+
params: {
|
|
5365
|
+
query: options.query,
|
|
5366
|
+
continuation: options.continuation,
|
|
5367
|
+
gl: options.gl,
|
|
5368
|
+
hl: options.hl
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
5371
|
+
);
|
|
5372
|
+
}
|
|
5373
|
+
/**
|
|
5374
|
+
* Resolve a @handle or URL to canonical YouTube ids.
|
|
5375
|
+
*
|
|
5376
|
+
* @param options - A `handle` or `url` (one is required) plus optional region.
|
|
5377
|
+
* @returns The resolved channel / video / playlist ids.
|
|
5378
|
+
*/
|
|
5379
|
+
async resolve(options = {}) {
|
|
5380
|
+
return this.client.request("/v1/youtube/channels/resolve", {
|
|
5381
|
+
params: { handle: options.handle, url: options.url, gl: options.gl, hl: options.hl }
|
|
5382
|
+
});
|
|
5383
|
+
}
|
|
5384
|
+
};
|
|
5385
|
+
|
|
5386
|
+
// src/youtube/playlists.ts
|
|
5387
|
+
var PlaylistsClient = class {
|
|
5388
|
+
client;
|
|
5389
|
+
constructor(client) {
|
|
5390
|
+
this.client = client;
|
|
5391
|
+
}
|
|
5392
|
+
/**
|
|
5393
|
+
* Get full playlist detail plus the first page of items.
|
|
5394
|
+
*
|
|
5395
|
+
* @param playlistId - The playlist id.
|
|
5396
|
+
* @param options - Optional region parameters.
|
|
5397
|
+
* @returns Full playlist detail with a continuation token.
|
|
5398
|
+
* @throws NotFoundError - If the playlist doesn't exist.
|
|
5399
|
+
*/
|
|
5400
|
+
async get(playlistId, options = {}) {
|
|
5401
|
+
return this.client.request(`/v1/youtube/playlists/${playlistId}`, {
|
|
5402
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
/**
|
|
5406
|
+
* Get a continuation page of a playlist's items.
|
|
5407
|
+
*
|
|
5408
|
+
* @param playlistId - The playlist id.
|
|
5409
|
+
* @param options - Optional continuation token and region.
|
|
5410
|
+
* @returns A page of playlist items with a continuation token.
|
|
5411
|
+
*/
|
|
5412
|
+
async items(playlistId, options = {}) {
|
|
5413
|
+
return this.client.request(
|
|
5414
|
+
`/v1/youtube/playlists/${playlistId}/items`,
|
|
5415
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5416
|
+
);
|
|
5417
|
+
}
|
|
5418
|
+
/**
|
|
5419
|
+
* Resolve an auto-generated mix / radio (RD…) queue.
|
|
5420
|
+
*
|
|
5421
|
+
* @param mixId - The mix / radio playlist id.
|
|
5422
|
+
* @param options - Optional region parameters.
|
|
5423
|
+
* @returns The mix as a playlist queue.
|
|
5424
|
+
*/
|
|
5425
|
+
async mix(mixId, options = {}) {
|
|
5426
|
+
return this.client.request(`/v1/youtube/mixes/${mixId}`, {
|
|
5427
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5428
|
+
});
|
|
5429
|
+
}
|
|
5430
|
+
};
|
|
5431
|
+
|
|
5432
|
+
// src/youtube/community.ts
|
|
5433
|
+
var CommunityClient = class {
|
|
5434
|
+
client;
|
|
5435
|
+
constructor(client) {
|
|
5436
|
+
this.client = client;
|
|
5437
|
+
}
|
|
5438
|
+
/**
|
|
5439
|
+
* Get a single community post's detail.
|
|
5440
|
+
*
|
|
5441
|
+
* @param postId - The community post id.
|
|
5442
|
+
* @param options - Optional region parameters.
|
|
5443
|
+
* @returns The community post.
|
|
5444
|
+
* @throws NotFoundError - If the post doesn't exist.
|
|
5445
|
+
*/
|
|
5446
|
+
async get(postId, options = {}) {
|
|
5447
|
+
return this.client.request(`/v1/youtube/posts/${postId}`, {
|
|
5448
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5449
|
+
});
|
|
5450
|
+
}
|
|
5451
|
+
/**
|
|
5452
|
+
* Get a page of comments on a community post.
|
|
5453
|
+
*
|
|
5454
|
+
* @param postId - The community post id.
|
|
5455
|
+
* @param options - Optional continuation token and region.
|
|
5456
|
+
* @returns A page of comments with a continuation token.
|
|
5457
|
+
*/
|
|
5458
|
+
async comments(postId, options = {}) {
|
|
5459
|
+
return this.client.request(
|
|
5460
|
+
`/v1/youtube/posts/${postId}/comments`,
|
|
5461
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5462
|
+
);
|
|
5463
|
+
}
|
|
5464
|
+
};
|
|
5465
|
+
|
|
5466
|
+
// src/youtube/shorts.ts
|
|
5467
|
+
var ShortsClient2 = class {
|
|
5468
|
+
client;
|
|
5469
|
+
constructor(client) {
|
|
5470
|
+
this.client = client;
|
|
5471
|
+
}
|
|
5472
|
+
/**
|
|
5473
|
+
* Get a single Short's detail.
|
|
5474
|
+
*
|
|
5475
|
+
* @param videoId - The Short's video id.
|
|
5476
|
+
* @param options - Optional region parameters.
|
|
5477
|
+
* @returns The Short detail.
|
|
5478
|
+
* @throws NotFoundError - If the Short doesn't exist or is unavailable.
|
|
5479
|
+
*/
|
|
5480
|
+
async get(videoId, options = {}) {
|
|
5481
|
+
return this.client.request(`/v1/youtube/shorts/${videoId}`, {
|
|
5482
|
+
params: { gl: options.gl, hl: options.hl }
|
|
5483
|
+
});
|
|
5484
|
+
}
|
|
5485
|
+
/**
|
|
5486
|
+
* Get a page of Shorts attributed to a given sound / music id (best-effort).
|
|
5487
|
+
*
|
|
5488
|
+
* @param soundId - The sound / music id.
|
|
5489
|
+
* @param options - Optional continuation token and region.
|
|
5490
|
+
* @returns A page of Shorts cards with a continuation token.
|
|
5491
|
+
*/
|
|
5492
|
+
async bySound(soundId, options = {}) {
|
|
5493
|
+
return this.client.request(
|
|
5494
|
+
`/v1/youtube/shorts/by_sound/${soundId}`,
|
|
5495
|
+
{ params: { continuation: options.continuation, gl: options.gl, hl: options.hl } }
|
|
5496
|
+
);
|
|
5497
|
+
}
|
|
5498
|
+
};
|
|
5499
|
+
|
|
5500
|
+
// src/youtube/trending.ts
|
|
5501
|
+
var TrendingClient2 = class {
|
|
5502
|
+
client;
|
|
5503
|
+
constructor(client) {
|
|
5504
|
+
this.client = client;
|
|
5505
|
+
}
|
|
5506
|
+
/**
|
|
5507
|
+
* Get a page of the trending feed.
|
|
5508
|
+
*
|
|
5509
|
+
* @param options - Optional feed type, continuation token, and region.
|
|
5510
|
+
* @returns A page of trending items with a continuation token.
|
|
5511
|
+
*/
|
|
5512
|
+
async get(options = {}) {
|
|
5513
|
+
return this.client.request("/v1/youtube/trending", {
|
|
5514
|
+
params: {
|
|
5515
|
+
type: options.type,
|
|
5516
|
+
continuation: options.continuation,
|
|
5517
|
+
gl: options.gl,
|
|
5518
|
+
hl: options.hl
|
|
5519
|
+
}
|
|
5520
|
+
});
|
|
5521
|
+
}
|
|
5522
|
+
/**
|
|
5523
|
+
* Get a page of trending Shorts.
|
|
5524
|
+
*
|
|
5525
|
+
* @param options - Optional continuation token and region.
|
|
5526
|
+
* @returns A page of trending Shorts with a continuation token.
|
|
5527
|
+
*/
|
|
5528
|
+
async shorts(options = {}) {
|
|
5529
|
+
return this.client.request("/v1/youtube/trending/shorts", {
|
|
5530
|
+
params: { continuation: options.continuation, gl: options.gl, hl: options.hl }
|
|
5531
|
+
});
|
|
5532
|
+
}
|
|
5533
|
+
/**
|
|
5534
|
+
* Get a page of videos under a hashtag.
|
|
5535
|
+
*
|
|
5536
|
+
* @param tag - The hashtag (with or without a leading `#`).
|
|
5537
|
+
* @param options - Optional continuation token and region.
|
|
5538
|
+
* @returns A page of hashtag results with a continuation token.
|
|
5539
|
+
*/
|
|
5540
|
+
async hashtag(tag, options = {}) {
|
|
5541
|
+
return this.client.request(`/v1/youtube/hashtags/${tag}`, {
|
|
5542
|
+
params: { continuation: options.continuation, gl: options.gl, hl: options.hl }
|
|
5543
|
+
});
|
|
5544
|
+
}
|
|
5545
|
+
/**
|
|
5546
|
+
* Get a page of the guest home / recommendations feed (best-effort).
|
|
5547
|
+
*
|
|
5548
|
+
* @param options - Optional continuation token and region.
|
|
5549
|
+
* @returns A page of home-feed results with a continuation token.
|
|
5550
|
+
*/
|
|
5551
|
+
async home(options = {}) {
|
|
5552
|
+
return this.client.request("/v1/youtube/home", {
|
|
5553
|
+
params: { continuation: options.continuation, gl: options.gl, hl: options.hl }
|
|
5554
|
+
});
|
|
5555
|
+
}
|
|
5556
|
+
};
|
|
5557
|
+
|
|
5558
|
+
// src/youtube/music.ts
|
|
5559
|
+
var MusicClient2 = class {
|
|
5560
|
+
client;
|
|
5561
|
+
constructor(client) {
|
|
5562
|
+
this.client = client;
|
|
5563
|
+
}
|
|
5564
|
+
/**
|
|
5565
|
+
* Search YouTube Music (songs / albums / artists / playlists).
|
|
5566
|
+
*
|
|
5567
|
+
* @param params - The required query plus optional continuation and region.
|
|
5568
|
+
* @returns A page of search results with a continuation token.
|
|
5569
|
+
*/
|
|
5570
|
+
async search(params) {
|
|
5571
|
+
return this.client.request("/v1/youtube/music/search", {
|
|
5572
|
+
params: {
|
|
5573
|
+
query: params.query,
|
|
5574
|
+
continuation: params.continuation,
|
|
5575
|
+
gl: params.gl,
|
|
5576
|
+
hl: params.hl
|
|
5577
|
+
}
|
|
5578
|
+
});
|
|
5579
|
+
}
|
|
5580
|
+
};
|
|
5581
|
+
|
|
5582
|
+
// src/youtube/reference.ts
|
|
5583
|
+
var ReferenceClient6 = class {
|
|
5584
|
+
client;
|
|
5585
|
+
constructor(client) {
|
|
5586
|
+
this.client = client;
|
|
5587
|
+
}
|
|
5588
|
+
/**
|
|
5589
|
+
* List YouTube video categories (Data-API parity).
|
|
5590
|
+
*
|
|
5591
|
+
* @param options - Optional content region (default: "US").
|
|
5592
|
+
* @returns The categories for the region.
|
|
5593
|
+
*/
|
|
5594
|
+
async categories(options = {}) {
|
|
5595
|
+
return this.client.request("/v1/youtube/categories", {
|
|
5596
|
+
params: { gl: options.gl }
|
|
5597
|
+
});
|
|
5598
|
+
}
|
|
5599
|
+
/**
|
|
5600
|
+
* List supported UI languages (hl codes).
|
|
5601
|
+
*
|
|
5602
|
+
* @returns The supported UI languages.
|
|
5603
|
+
*/
|
|
5604
|
+
async languages() {
|
|
5605
|
+
return this.client.request("/v1/youtube/languages");
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* List supported content regions (gl codes).
|
|
5609
|
+
*
|
|
5610
|
+
* @returns The supported content regions.
|
|
5611
|
+
*/
|
|
5612
|
+
async regions() {
|
|
5613
|
+
return this.client.request("/v1/youtube/regions");
|
|
5614
|
+
}
|
|
5615
|
+
/**
|
|
5616
|
+
* List the regions the scraper explicitly geo-targets (proxy-pinned).
|
|
5617
|
+
*
|
|
5618
|
+
* @returns The supported scraper markets.
|
|
5619
|
+
*/
|
|
5620
|
+
async markets() {
|
|
5621
|
+
return this.client.request("/v1/youtube/markets");
|
|
5622
|
+
}
|
|
5623
|
+
};
|
|
5624
|
+
|
|
5625
|
+
// src/youtube/client.ts
|
|
5626
|
+
var YoutubeClient = class {
|
|
5627
|
+
/** Client for full-matrix search and keyword autocomplete */
|
|
5628
|
+
search;
|
|
5629
|
+
/** Client for video detail, comments, transcript, captions, streams, live chat, batch, and oEmbed */
|
|
5630
|
+
videos;
|
|
5631
|
+
/** Client for channel detail, tab feeds, about, subscriber count, search, and resolve */
|
|
5632
|
+
channels;
|
|
5633
|
+
/** Client for playlist detail, items pagination, and mixes */
|
|
5634
|
+
playlists;
|
|
5635
|
+
/** Client for community post detail and post comments */
|
|
5636
|
+
community;
|
|
5637
|
+
/** Client for single-Short detail and Shorts by sound */
|
|
5638
|
+
shorts;
|
|
5639
|
+
/** Client for the trending feed, trending shorts, hashtag feed, and home feed */
|
|
5640
|
+
trending;
|
|
5641
|
+
/** Client for YouTube Music search */
|
|
5642
|
+
music;
|
|
5643
|
+
/** Client for reference data (categories, languages, regions, markets) */
|
|
5644
|
+
reference;
|
|
5645
|
+
/**
|
|
5646
|
+
* Create a new YouTube client.
|
|
5647
|
+
*
|
|
5648
|
+
* @param client - The base HTTP client for making requests.
|
|
5649
|
+
*/
|
|
5650
|
+
constructor(client) {
|
|
5651
|
+
this.search = new SearchClient8(client);
|
|
5652
|
+
this.videos = new VideosClient3(client);
|
|
5653
|
+
this.channels = new ChannelsClient(client);
|
|
5654
|
+
this.playlists = new PlaylistsClient(client);
|
|
5655
|
+
this.community = new CommunityClient(client);
|
|
5656
|
+
this.shorts = new ShortsClient2(client);
|
|
5657
|
+
this.trending = new TrendingClient2(client);
|
|
5658
|
+
this.music = new MusicClient2(client);
|
|
5659
|
+
this.reference = new ReferenceClient6(client);
|
|
5660
|
+
}
|
|
5661
|
+
};
|
|
5662
|
+
|
|
5057
5663
|
// src/client.ts
|
|
5058
5664
|
var ScrapeBadger = class {
|
|
5059
5665
|
baseClient;
|
|
@@ -5075,6 +5681,8 @@ var ScrapeBadger = class {
|
|
|
5075
5681
|
tiktok;
|
|
5076
5682
|
/** eBay scraper API client — 12 endpoints across 18 markets */
|
|
5077
5683
|
ebay;
|
|
5684
|
+
/** YouTube scraper API client — 39 endpoints */
|
|
5685
|
+
youtube;
|
|
5078
5686
|
/**
|
|
5079
5687
|
* Create a new ScrapeBadger client.
|
|
5080
5688
|
*
|
|
@@ -5118,6 +5726,7 @@ var ScrapeBadger = class {
|
|
|
5118
5726
|
this.shopee = new ShopeeClient(this.baseClient);
|
|
5119
5727
|
this.tiktok = new TikTokClient(this.baseClient);
|
|
5120
5728
|
this.ebay = new EbayClient(this.baseClient);
|
|
5729
|
+
this.youtube = new YoutubeClient(this.baseClient);
|
|
5121
5730
|
}
|
|
5122
5731
|
};
|
|
5123
5732
|
|
|
@@ -5198,6 +5807,16 @@ exports.VintedSearchClient = SearchClient;
|
|
|
5198
5807
|
exports.VintedUsersClient = UsersClient2;
|
|
5199
5808
|
exports.WebClient = WebClient;
|
|
5200
5809
|
exports.WebSocketStreamError = WebSocketStreamError;
|
|
5810
|
+
exports.YoutubeChannelsClient = ChannelsClient;
|
|
5811
|
+
exports.YoutubeClient = YoutubeClient;
|
|
5812
|
+
exports.YoutubeCommunityClient = CommunityClient;
|
|
5813
|
+
exports.YoutubeMusicClient = MusicClient2;
|
|
5814
|
+
exports.YoutubePlaylistsClient = PlaylistsClient;
|
|
5815
|
+
exports.YoutubeReferenceClient = ReferenceClient6;
|
|
5816
|
+
exports.YoutubeSearchClient = SearchClient8;
|
|
5817
|
+
exports.YoutubeShortsClient = ShortsClient2;
|
|
5818
|
+
exports.YoutubeTrendingClient = TrendingClient2;
|
|
5819
|
+
exports.YoutubeVideosClient = VideosClient3;
|
|
5201
5820
|
exports.collectAll = collectAll;
|
|
5202
5821
|
exports.verifyWebhookSignature = verifyWebhookSignature;
|
|
5203
5822
|
//# sourceMappingURL=index.js.map
|