@hallelx/tytube 0.1.1
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/LICENSE +24 -0
- package/README.md +189 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2708 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +2552 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +488 -0
- package/dist/index.d.ts +488 -0
- package/dist/index.js +2523 -0
- package/dist/index.js.map +1 -0
- package/package.json +72 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
interface RawCaptionTrack {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
name?: {
|
|
4
|
+
simpleText?: string;
|
|
5
|
+
runs?: Array<{
|
|
6
|
+
text: string;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
vssId?: string;
|
|
10
|
+
languageCode?: string;
|
|
11
|
+
}
|
|
12
|
+
declare class Caption {
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly code: string;
|
|
16
|
+
constructor(track: RawCaptionTrack);
|
|
17
|
+
xmlCaptions(): Promise<string>;
|
|
18
|
+
jsonCaptions(): Promise<unknown>;
|
|
19
|
+
generateSrtCaptions(): Promise<string>;
|
|
20
|
+
static floatToSrtTimeFormat(d: number): string;
|
|
21
|
+
static xmlCaptionToSrt(xml: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Write the caption track to disk as SRT or XML.
|
|
24
|
+
* Returns the absolute path of the written file.
|
|
25
|
+
*/
|
|
26
|
+
download(title: string, opts?: {
|
|
27
|
+
srt?: boolean;
|
|
28
|
+
outputPath?: string;
|
|
29
|
+
filenamePrefix?: string;
|
|
30
|
+
}): Promise<string>;
|
|
31
|
+
toString(): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare class PytubeError extends Error {
|
|
35
|
+
constructor(message?: string);
|
|
36
|
+
}
|
|
37
|
+
declare class MaxRetriesExceeded extends PytubeError {
|
|
38
|
+
constructor(message?: string);
|
|
39
|
+
}
|
|
40
|
+
declare class HTMLParseError extends PytubeError {
|
|
41
|
+
constructor(message?: string);
|
|
42
|
+
}
|
|
43
|
+
declare class ExtractError extends PytubeError {
|
|
44
|
+
constructor(message?: string);
|
|
45
|
+
}
|
|
46
|
+
declare class RegexMatchError extends ExtractError {
|
|
47
|
+
readonly caller: string;
|
|
48
|
+
readonly pattern: string | RegExp;
|
|
49
|
+
constructor(caller: string, pattern: string | RegExp);
|
|
50
|
+
}
|
|
51
|
+
declare class VideoUnavailable extends PytubeError {
|
|
52
|
+
readonly videoId: string;
|
|
53
|
+
constructor(videoId: string, message?: string);
|
|
54
|
+
}
|
|
55
|
+
declare class AgeRestrictedError extends VideoUnavailable {
|
|
56
|
+
constructor(videoId: string);
|
|
57
|
+
}
|
|
58
|
+
declare class LiveStreamError extends VideoUnavailable {
|
|
59
|
+
constructor(videoId: string);
|
|
60
|
+
}
|
|
61
|
+
declare class VideoPrivate extends VideoUnavailable {
|
|
62
|
+
constructor(videoId: string);
|
|
63
|
+
}
|
|
64
|
+
declare class RecordingUnavailable extends VideoUnavailable {
|
|
65
|
+
constructor(videoId: string);
|
|
66
|
+
}
|
|
67
|
+
declare class MembersOnly extends VideoUnavailable {
|
|
68
|
+
constructor(videoId: string);
|
|
69
|
+
}
|
|
70
|
+
declare class VideoRegionBlocked extends VideoUnavailable {
|
|
71
|
+
constructor(videoId: string);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface MetadataRow {
|
|
75
|
+
title?: {
|
|
76
|
+
simpleText?: string;
|
|
77
|
+
};
|
|
78
|
+
contents?: Array<{
|
|
79
|
+
simpleText?: string;
|
|
80
|
+
runs?: Array<{
|
|
81
|
+
text: string;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
84
|
+
hasDividerLine?: boolean;
|
|
85
|
+
}
|
|
86
|
+
declare class YouTubeMetadata implements Iterable<Record<string, string>> {
|
|
87
|
+
private readonly raw;
|
|
88
|
+
private readonly groups;
|
|
89
|
+
constructor(rawRows: MetadataRow[]);
|
|
90
|
+
get rawMetadata(): MetadataRow[];
|
|
91
|
+
get metadata(): Record<string, string>[];
|
|
92
|
+
at(index: number): Record<string, string> | undefined;
|
|
93
|
+
[Symbol.iterator](): Iterator<Record<string, string>>;
|
|
94
|
+
toJSON(): Record<string, string>[];
|
|
95
|
+
toString(): string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface StreamFormat {
|
|
99
|
+
itag: number;
|
|
100
|
+
url?: string;
|
|
101
|
+
signatureCipher?: string;
|
|
102
|
+
cipher?: string;
|
|
103
|
+
s?: string;
|
|
104
|
+
type?: string;
|
|
105
|
+
is_otf?: boolean;
|
|
106
|
+
mimeType?: string;
|
|
107
|
+
bitrate?: number;
|
|
108
|
+
contentLength?: string;
|
|
109
|
+
width?: number;
|
|
110
|
+
height?: number;
|
|
111
|
+
fps?: number;
|
|
112
|
+
qualityLabel?: string;
|
|
113
|
+
audioQuality?: string;
|
|
114
|
+
averageBitrate?: number;
|
|
115
|
+
approxDurationMs?: string;
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface SharedState {
|
|
120
|
+
title: string | null;
|
|
121
|
+
duration: number | null;
|
|
122
|
+
onProgress?: (stream: Stream, chunk: Uint8Array, bytesRemaining: number) => void;
|
|
123
|
+
onComplete?: (stream: Stream, filePath: string | null) => void;
|
|
124
|
+
}
|
|
125
|
+
interface DownloadOptions {
|
|
126
|
+
outputPath?: string;
|
|
127
|
+
filename?: string;
|
|
128
|
+
filenamePrefix?: string;
|
|
129
|
+
skipExisting?: boolean;
|
|
130
|
+
timeoutMs?: number;
|
|
131
|
+
maxRetries?: number;
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
}
|
|
134
|
+
declare class Stream {
|
|
135
|
+
readonly itag: number;
|
|
136
|
+
url: string;
|
|
137
|
+
readonly mimeType: string;
|
|
138
|
+
readonly codecs: string[];
|
|
139
|
+
readonly type: string;
|
|
140
|
+
readonly subtype: string;
|
|
141
|
+
readonly videoCodec: string | null;
|
|
142
|
+
readonly audioCodec: string | null;
|
|
143
|
+
readonly isOtf: boolean;
|
|
144
|
+
readonly bitrate: number | null;
|
|
145
|
+
readonly fps: number | null;
|
|
146
|
+
readonly resolution: string | null;
|
|
147
|
+
readonly abr: string | null;
|
|
148
|
+
readonly isDash: boolean;
|
|
149
|
+
readonly is3d: boolean;
|
|
150
|
+
readonly isHdr: boolean;
|
|
151
|
+
readonly isLive: boolean;
|
|
152
|
+
private cachedFilesize;
|
|
153
|
+
private readonly state;
|
|
154
|
+
constructor(raw: StreamFormat, state: SharedState);
|
|
155
|
+
get isAdaptive(): boolean;
|
|
156
|
+
get isProgressive(): boolean;
|
|
157
|
+
get includesAudioTrack(): boolean;
|
|
158
|
+
get includesVideoTrack(): boolean;
|
|
159
|
+
private parseCodecs;
|
|
160
|
+
get title(): string;
|
|
161
|
+
filesize(): Promise<number>;
|
|
162
|
+
filesizeApprox(): Promise<number>;
|
|
163
|
+
get expiration(): Date | null;
|
|
164
|
+
get defaultFilename(): string;
|
|
165
|
+
/** Compute the absolute output path the download will be written to. */
|
|
166
|
+
getFilePath(opts?: DownloadOptions): Promise<string>;
|
|
167
|
+
existsAtPath(filePath: string): Promise<boolean>;
|
|
168
|
+
/**
|
|
169
|
+
* Download the stream to the local filesystem and return the absolute path.
|
|
170
|
+
* Throws if no filesystem is available (e.g., browser); use streamChunks() instead.
|
|
171
|
+
*/
|
|
172
|
+
download(opts?: DownloadOptions): Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Stream the media as raw chunks. Browser-friendly alternative to download().
|
|
175
|
+
* Caller is responsible for collecting the chunks (write to a Blob, sink, etc.).
|
|
176
|
+
*/
|
|
177
|
+
streamChunks(opts?: DownloadOptions): AsyncGenerator<Uint8Array>;
|
|
178
|
+
private fireOnProgress;
|
|
179
|
+
private fireOnComplete;
|
|
180
|
+
toString(): string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
type StreamPredicate = (s: Stream) => boolean;
|
|
184
|
+
interface FilterCriteria {
|
|
185
|
+
fps?: number;
|
|
186
|
+
res?: string | string[];
|
|
187
|
+
resolution?: string | string[];
|
|
188
|
+
mimeType?: string;
|
|
189
|
+
type?: string;
|
|
190
|
+
subtype?: string;
|
|
191
|
+
fileExtension?: string;
|
|
192
|
+
abr?: string;
|
|
193
|
+
bitrate?: string;
|
|
194
|
+
videoCodec?: string;
|
|
195
|
+
audioCodec?: string;
|
|
196
|
+
onlyAudio?: boolean;
|
|
197
|
+
onlyVideo?: boolean;
|
|
198
|
+
progressive?: boolean;
|
|
199
|
+
adaptive?: boolean;
|
|
200
|
+
isDash?: boolean;
|
|
201
|
+
customFilters?: StreamPredicate[];
|
|
202
|
+
}
|
|
203
|
+
declare class StreamQuery implements Iterable<Stream> {
|
|
204
|
+
readonly fmtStreams: Stream[];
|
|
205
|
+
private readonly itagIndex;
|
|
206
|
+
constructor(fmtStreams: Stream[]);
|
|
207
|
+
filter(criteria?: FilterCriteria): StreamQuery;
|
|
208
|
+
private applyFilters;
|
|
209
|
+
/**
|
|
210
|
+
* Sort by an attribute. Filters out streams that don't have it. For string
|
|
211
|
+
* attributes (e.g., "720p"), sorts by the embedded integer.
|
|
212
|
+
*/
|
|
213
|
+
orderBy(attribute: keyof Stream): StreamQuery;
|
|
214
|
+
desc(): StreamQuery;
|
|
215
|
+
asc(): StreamQuery;
|
|
216
|
+
getByItag(itag: number): Stream | undefined;
|
|
217
|
+
getByResolution(resolution: string): Stream | undefined;
|
|
218
|
+
getLowestResolution(): Stream | undefined;
|
|
219
|
+
getHighestResolution(): Stream | undefined;
|
|
220
|
+
getAudioOnly(subtype?: string): Stream | undefined;
|
|
221
|
+
otf(isOtf?: boolean): StreamQuery;
|
|
222
|
+
first(): Stream | undefined;
|
|
223
|
+
last(): Stream | undefined;
|
|
224
|
+
get length(): number;
|
|
225
|
+
at(index: number): Stream | undefined;
|
|
226
|
+
toArray(): Stream[];
|
|
227
|
+
[Symbol.iterator](): Iterator<Stream>;
|
|
228
|
+
}
|
|
229
|
+
declare class CaptionQuery implements Iterable<Caption> {
|
|
230
|
+
private readonly index;
|
|
231
|
+
constructor(captions: Caption[]);
|
|
232
|
+
get(langCode: string): Caption | undefined;
|
|
233
|
+
has(langCode: string): boolean;
|
|
234
|
+
get length(): number;
|
|
235
|
+
toArray(): Caption[];
|
|
236
|
+
[Symbol.iterator](): Iterator<Caption>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface YouTubeOptions {
|
|
240
|
+
onProgress?: SharedState['onProgress'];
|
|
241
|
+
onComplete?: SharedState['onComplete'];
|
|
242
|
+
useOauth?: boolean;
|
|
243
|
+
allowOauthCache?: boolean;
|
|
244
|
+
}
|
|
245
|
+
interface YtVideoDetails {
|
|
246
|
+
videoId?: string;
|
|
247
|
+
title?: string;
|
|
248
|
+
lengthSeconds?: string;
|
|
249
|
+
author?: string;
|
|
250
|
+
shortDescription?: string;
|
|
251
|
+
averageRating?: number;
|
|
252
|
+
viewCount?: string;
|
|
253
|
+
channelId?: string;
|
|
254
|
+
thumbnail?: {
|
|
255
|
+
thumbnails?: Array<{
|
|
256
|
+
url: string;
|
|
257
|
+
}>;
|
|
258
|
+
};
|
|
259
|
+
keywords?: string[];
|
|
260
|
+
}
|
|
261
|
+
interface YtCaptionTrackRaw {
|
|
262
|
+
baseUrl: string;
|
|
263
|
+
name?: {
|
|
264
|
+
simpleText?: string;
|
|
265
|
+
runs?: Array<{
|
|
266
|
+
text: string;
|
|
267
|
+
}>;
|
|
268
|
+
};
|
|
269
|
+
vssId?: string;
|
|
270
|
+
languageCode?: string;
|
|
271
|
+
}
|
|
272
|
+
interface PlayerResponse {
|
|
273
|
+
videoDetails?: YtVideoDetails;
|
|
274
|
+
playabilityStatus?: {
|
|
275
|
+
status?: string;
|
|
276
|
+
reason?: string;
|
|
277
|
+
messages?: string[];
|
|
278
|
+
liveStreamability?: unknown;
|
|
279
|
+
};
|
|
280
|
+
streamingData?: {
|
|
281
|
+
formats?: StreamFormat[];
|
|
282
|
+
adaptiveFormats?: StreamFormat[];
|
|
283
|
+
};
|
|
284
|
+
captions?: {
|
|
285
|
+
playerCaptionsTracklistRenderer?: {
|
|
286
|
+
captionTracks?: YtCaptionTrackRaw[];
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
declare class YouTube {
|
|
291
|
+
readonly videoId: string;
|
|
292
|
+
readonly watchUrl: string;
|
|
293
|
+
readonly embedUrl: string;
|
|
294
|
+
readonly useOauth: boolean;
|
|
295
|
+
readonly allowOauthCache: boolean;
|
|
296
|
+
readonly state: SharedState;
|
|
297
|
+
private cachedJs;
|
|
298
|
+
private cachedJsUrl;
|
|
299
|
+
private cachedVidInfo;
|
|
300
|
+
private cachedWatchHtml;
|
|
301
|
+
private cachedEmbedHtml;
|
|
302
|
+
private cachedAgeRestricted;
|
|
303
|
+
private cachedFmtStreams;
|
|
304
|
+
private cachedInitialData;
|
|
305
|
+
private cachedMetadata;
|
|
306
|
+
private cachedTitle;
|
|
307
|
+
private cachedAuthor;
|
|
308
|
+
private cachedPublishDate;
|
|
309
|
+
constructor(url: string, opts?: YouTubeOptions);
|
|
310
|
+
static fromId(videoId: string): YouTube;
|
|
311
|
+
watchHtml(): Promise<string>;
|
|
312
|
+
embedHtml(): Promise<string>;
|
|
313
|
+
ageRestricted(): Promise<boolean>;
|
|
314
|
+
jsUrl(): Promise<string>;
|
|
315
|
+
js(): Promise<string>;
|
|
316
|
+
initialData(): Promise<unknown>;
|
|
317
|
+
/**
|
|
318
|
+
* Resolve the player response containing videoDetails + streamingData.
|
|
319
|
+
*
|
|
320
|
+
* Strategy (late-2025 reality):
|
|
321
|
+
* 1. Primary: scrape `ytInitialPlayerResponse` from the watch HTML. This is
|
|
322
|
+
* the same payload a browser sees and contains streamingData + captions.
|
|
323
|
+
* 2. Fallback: InnerTube /player endpoint (useful for age-gate bypass, but
|
|
324
|
+
* currently rate-limited by YouTube's "Sign in to confirm you're not a
|
|
325
|
+
* bot" check for server-side IPs).
|
|
326
|
+
*
|
|
327
|
+
* If the primary path returns a useful response we never touch InnerTube,
|
|
328
|
+
* which avoids the bot-detection entirely for normal public videos.
|
|
329
|
+
*/
|
|
330
|
+
vidInfo(): Promise<PlayerResponse>;
|
|
331
|
+
streamingData(): Promise<NonNullable<PlayerResponse['streamingData']>>;
|
|
332
|
+
checkAvailability(): Promise<void>;
|
|
333
|
+
bypassAgeGate(): Promise<void>;
|
|
334
|
+
fmtStreams(): Promise<Stream[]>;
|
|
335
|
+
streams(): Promise<StreamQuery>;
|
|
336
|
+
captionTracks(): Promise<Caption[]>;
|
|
337
|
+
captions(): Promise<CaptionQuery>;
|
|
338
|
+
title(): Promise<string>;
|
|
339
|
+
description(): Promise<string | null>;
|
|
340
|
+
length(): Promise<number>;
|
|
341
|
+
views(): Promise<number>;
|
|
342
|
+
rating(): Promise<number | null>;
|
|
343
|
+
author(): Promise<string>;
|
|
344
|
+
keywords(): Promise<string[]>;
|
|
345
|
+
channelId(): Promise<string | null>;
|
|
346
|
+
channelUrl(): Promise<string>;
|
|
347
|
+
thumbnailUrl(): Promise<string>;
|
|
348
|
+
publishDate(): Promise<Date | null>;
|
|
349
|
+
metadata(): Promise<YouTubeMetadata>;
|
|
350
|
+
/**
|
|
351
|
+
* Fetch and cache everything needed for synchronous metadata access.
|
|
352
|
+
* After this resolves, the *Sync getters and the `streams` getter return
|
|
353
|
+
* results immediately without further network I/O.
|
|
354
|
+
*/
|
|
355
|
+
prefetch(): Promise<void>;
|
|
356
|
+
get titleSync(): string;
|
|
357
|
+
get authorSync(): string;
|
|
358
|
+
get streamsSync(): StreamQuery;
|
|
359
|
+
registerOnProgressCallback(fn: SharedState['onProgress']): void;
|
|
360
|
+
registerOnCompleteCallback(fn: SharedState['onComplete']): void;
|
|
361
|
+
toString(): string;
|
|
362
|
+
equals(other: unknown): boolean;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface ContinuationRequest {
|
|
366
|
+
url: string;
|
|
367
|
+
headers: Record<string, string>;
|
|
368
|
+
data: Record<string, unknown>;
|
|
369
|
+
}
|
|
370
|
+
declare class Playlist implements AsyncIterable<YouTube> {
|
|
371
|
+
protected readonly inputUrl: string;
|
|
372
|
+
private cachedHtml;
|
|
373
|
+
private cachedYtcfg;
|
|
374
|
+
private cachedInitialData;
|
|
375
|
+
private cachedSidebar;
|
|
376
|
+
private cachedPlaylistId;
|
|
377
|
+
private cachedVideoUrls;
|
|
378
|
+
constructor(url: string);
|
|
379
|
+
get playlistId(): string;
|
|
380
|
+
get playlistUrl(): string;
|
|
381
|
+
html(): Promise<string>;
|
|
382
|
+
ytcfg(): Promise<Record<string, unknown>>;
|
|
383
|
+
initialData(): Promise<Record<string, unknown>>;
|
|
384
|
+
sidebarInfo(): Promise<unknown[]>;
|
|
385
|
+
ytApiKey(): Promise<string>;
|
|
386
|
+
protected paginate(untilWatchId?: string): AsyncGenerator<string[]>;
|
|
387
|
+
protected buildContinuationRequest(continuation: string): Promise<ContinuationRequest>;
|
|
388
|
+
protected static extractVideos(rawJson: string): [string[], string | null];
|
|
389
|
+
videoUrls(): Promise<string[]>;
|
|
390
|
+
videos(): AsyncGenerator<YouTube>;
|
|
391
|
+
length(): Promise<number>;
|
|
392
|
+
[Symbol.asyncIterator](): AsyncIterator<YouTube>;
|
|
393
|
+
title(): Promise<string | null>;
|
|
394
|
+
description(): Promise<string | null>;
|
|
395
|
+
owner(): Promise<string | null>;
|
|
396
|
+
ownerId(): Promise<string | null>;
|
|
397
|
+
ownerUrl(): Promise<string | null>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare class Channel extends Playlist {
|
|
401
|
+
readonly channelUri: string;
|
|
402
|
+
readonly channelUrl: string;
|
|
403
|
+
readonly videosUrl: string;
|
|
404
|
+
readonly playlistsUrl: string;
|
|
405
|
+
readonly communityUrl: string;
|
|
406
|
+
readonly featuredChannelsUrl: string;
|
|
407
|
+
readonly aboutUrl: string;
|
|
408
|
+
private cachedVideosHtml;
|
|
409
|
+
constructor(url: string);
|
|
410
|
+
html(): Promise<string>;
|
|
411
|
+
channelName(): Promise<string | null>;
|
|
412
|
+
channelId(): Promise<string | null>;
|
|
413
|
+
vanityUrl(): Promise<string | null>;
|
|
414
|
+
protected static extractVideos(rawJson: string): [string[], string | null];
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
declare class Search {
|
|
418
|
+
readonly query: string;
|
|
419
|
+
private readonly innertube;
|
|
420
|
+
private cachedResults;
|
|
421
|
+
private currentContinuation;
|
|
422
|
+
private initialResults;
|
|
423
|
+
constructor(query: string);
|
|
424
|
+
results(): Promise<YouTube[]>;
|
|
425
|
+
/** Fetch the next page of results and append to the cached results array. */
|
|
426
|
+
getNextResults(): Promise<void>;
|
|
427
|
+
completionSuggestions(): Promise<string[] | null>;
|
|
428
|
+
fetchAndParse(continuation?: string): Promise<[YouTube[], string | null]>;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
interface InnerTubeClientConfig {
|
|
432
|
+
context: {
|
|
433
|
+
client: Record<string, unknown>;
|
|
434
|
+
};
|
|
435
|
+
header: Record<string, string>;
|
|
436
|
+
apiKey: string;
|
|
437
|
+
}
|
|
438
|
+
declare const DEFAULT_CLIENTS: Record<string, InnerTubeClientConfig>;
|
|
439
|
+
type InnerTubeClientName = keyof typeof DEFAULT_CLIENTS;
|
|
440
|
+
interface InnerTubeOptions {
|
|
441
|
+
client?: InnerTubeClientName;
|
|
442
|
+
useOauth?: boolean;
|
|
443
|
+
onAuthPrompt?: (verificationUrl: string, userCode: string) => Promise<void>;
|
|
444
|
+
}
|
|
445
|
+
declare class InnerTube {
|
|
446
|
+
private readonly context;
|
|
447
|
+
private readonly header;
|
|
448
|
+
private readonly apiKey;
|
|
449
|
+
private readonly useOauth;
|
|
450
|
+
private readonly onAuthPrompt?;
|
|
451
|
+
private accessToken;
|
|
452
|
+
private refreshToken;
|
|
453
|
+
private expires;
|
|
454
|
+
constructor(opts?: InnerTubeOptions);
|
|
455
|
+
get baseUrl(): string;
|
|
456
|
+
private baseData;
|
|
457
|
+
private endpointUrl;
|
|
458
|
+
private callApi;
|
|
459
|
+
player<T = unknown>(videoId: string): Promise<T>;
|
|
460
|
+
search<T = unknown>(searchQuery: string, continuation?: string): Promise<T>;
|
|
461
|
+
browse<T = unknown>(continuation: string): Promise<T>;
|
|
462
|
+
verifyAge<T = unknown>(videoId: string): Promise<T>;
|
|
463
|
+
getTranscript<T = unknown>(videoId: string): Promise<T>;
|
|
464
|
+
private refreshBearerToken;
|
|
465
|
+
private fetchBearerToken;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface ItagInfo {
|
|
469
|
+
resolution: string | null;
|
|
470
|
+
abr: string | null;
|
|
471
|
+
}
|
|
472
|
+
interface FormatProfile {
|
|
473
|
+
resolution: string | null;
|
|
474
|
+
abr: string | null;
|
|
475
|
+
isLive: boolean;
|
|
476
|
+
is3d: boolean;
|
|
477
|
+
isHdr: boolean;
|
|
478
|
+
isDash: boolean;
|
|
479
|
+
}
|
|
480
|
+
declare const PROGRESSIVE_VIDEO: Record<number, ItagInfo>;
|
|
481
|
+
declare const DASH_VIDEO: Record<number, ItagInfo>;
|
|
482
|
+
declare const DASH_AUDIO: Record<number, ItagInfo>;
|
|
483
|
+
declare const ITAGS: Record<number, ItagInfo>;
|
|
484
|
+
declare function getFormatProfile(itag: number | string): FormatProfile;
|
|
485
|
+
|
|
486
|
+
declare const VERSION = "0.1.1";
|
|
487
|
+
|
|
488
|
+
export { AgeRestrictedError, Caption, CaptionQuery, Channel, DASH_AUDIO, DASH_VIDEO, type DownloadOptions, ExtractError, type FilterCriteria, type FormatProfile, HTMLParseError, ITAGS, InnerTube, type InnerTubeClientName, type InnerTubeOptions, type ItagInfo, LiveStreamError, MaxRetriesExceeded, MembersOnly, PROGRESSIVE_VIDEO, Playlist, PytubeError, type RawCaptionTrack, RecordingUnavailable, RegexMatchError, Search, type SharedState, Stream, type StreamPredicate, StreamQuery, VERSION, VideoPrivate, VideoRegionBlocked, VideoUnavailable, YouTube, YouTubeMetadata, type YouTubeOptions, getFormatProfile };
|