@oreohq/ytdl-core 4.15.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.
@@ -0,0 +1,1016 @@
1
+ declare module "tough-cookie" {
2
+ export const version: string;
3
+
4
+ export const PrefixSecurityEnum: Readonly<{
5
+ DISABLED: string;
6
+ SILENT: string;
7
+ STRICT: string;
8
+ }>;
9
+
10
+ /**
11
+ * Parse a cookie date string into a Date.
12
+ * Parses according to RFC6265 Section 5.1.1, not Date.parse().
13
+ */
14
+ export function parseDate(string: string): Date;
15
+
16
+ /**
17
+ * Format a Date into a RFC1123 string (the RFC6265-recommended format).
18
+ */
19
+ export function formatDate(date: Date): string;
20
+
21
+ /**
22
+ * Transforms a domain-name into a canonical domain-name.
23
+ * The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot
24
+ * and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265).
25
+ * For the most part, this function is idempotent (can be run again on its output without ill effects).
26
+ */
27
+ export function canonicalDomain(str: string): string;
28
+
29
+ /**
30
+ * Answers "does this real domain match the domain in a cookie?".
31
+ * The str is the "current" domain-name and the domStr is the "cookie" domain-name.
32
+ * Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".
33
+ *
34
+ * The canonicalize parameter will run the other two parameters through canonicalDomain or not.
35
+ */
36
+ export function domainMatch(str: string, domStr: string, canonicalize?: boolean): boolean;
37
+
38
+ /**
39
+ * Given a current request/response path, gives the Path apropriate for storing in a cookie.
40
+ * This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC.
41
+ *
42
+ * The path parameter MUST be only the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.).
43
+ * This is the .pathname property of node's uri.parse() output.
44
+ */
45
+ export function defaultPath(path: string): string;
46
+
47
+ /**
48
+ * Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4.
49
+ * Returns a boolean.
50
+ *
51
+ * This is essentially a prefix-match where cookiePath is a prefix of reqPath.
52
+ */
53
+ export function pathMatch(reqPath: string, cookiePath: string): boolean;
54
+
55
+ /**
56
+ * alias for Cookie.parse(cookieString[, options])
57
+ */
58
+ export function parse(cookieString: string, options?: Cookie.ParseOptions): Cookie | undefined;
59
+
60
+ /**
61
+ * alias for Cookie.fromJSON(string)
62
+ */
63
+ export function fromJSON(string: string): Cookie;
64
+
65
+ export function getPublicSuffix(hostname: string): string | null;
66
+
67
+ export function cookieCompare(a: Cookie, b: Cookie): number;
68
+
69
+ export function permuteDomain(domain: string, allowSpecialUseDomain?: boolean): string[];
70
+
71
+ export function permutePath(path: string): string[];
72
+
73
+ export class Cookie {
74
+ static parse(cookieString: string, options?: Cookie.ParseOptions): Cookie | undefined;
75
+
76
+ static fromJSON(strOrObj: string | object): Cookie | null;
77
+
78
+ constructor(properties?: Cookie.Properties);
79
+
80
+ key: string;
81
+ value: string;
82
+ expires: Date | "Infinity";
83
+ maxAge: number | "Infinity" | "-Infinity";
84
+ domain: string | null;
85
+ path: string | null;
86
+ secure: boolean;
87
+ httpOnly: boolean;
88
+ extensions: string[] | null;
89
+ creation: Date | null;
90
+ creationIndex: number;
91
+
92
+ hostOnly: boolean | null;
93
+ pathIsDefault: boolean | null;
94
+ lastAccessed: Date | null;
95
+ sameSite: string;
96
+
97
+ toString(): string;
98
+
99
+ cookieString(): string;
100
+
101
+ setExpires(exp: Date | string): void;
102
+
103
+ setMaxAge(number: number): void;
104
+
105
+ expiryTime(now?: number): number;
106
+
107
+ expiryDate(now?: number): Date;
108
+
109
+ TTL(now?: Date): number | typeof Infinity;
110
+
111
+ isPersistent(): boolean;
112
+
113
+ canonicalizedDomain(): string | null;
114
+
115
+ cdomain(): string | null;
116
+
117
+ inspect(): string;
118
+
119
+ toJSON(): { [key: string]: any };
120
+
121
+ clone(): Cookie;
122
+
123
+ validate(): boolean | string;
124
+ }
125
+
126
+ export namespace Cookie {
127
+ interface ParseOptions {
128
+ loose?: boolean | undefined;
129
+ }
130
+
131
+ interface Properties {
132
+ key?: string | undefined;
133
+ value?: string | undefined;
134
+ expires?: Date | "Infinity" | undefined;
135
+ maxAge?: number | "Infinity" | "-Infinity" | undefined;
136
+ domain?: string | undefined;
137
+ path?: string | undefined;
138
+ secure?: boolean | undefined;
139
+ httpOnly?: boolean | undefined;
140
+ extensions?: string[] | undefined;
141
+ creation?: Date | undefined;
142
+ creationIndex?: number | undefined;
143
+
144
+ hostOnly?: boolean | undefined;
145
+ pathIsDefault?: boolean | undefined;
146
+ lastAccessed?: Date | undefined;
147
+ sameSite?: string | undefined;
148
+ }
149
+
150
+ interface Serialized {
151
+ [key: string]: any;
152
+ }
153
+ }
154
+
155
+ export class CookieJar {
156
+ static deserialize(serialized: CookieJar.Serialized | string, store?: Store): Promise<CookieJar>;
157
+ static deserialize(
158
+ serialized: CookieJar.Serialized | string,
159
+ store: Store,
160
+ cb: (err: Error | null, object: CookieJar) => void,
161
+ ): void;
162
+ static deserialize(
163
+ serialized: CookieJar.Serialized | string,
164
+ cb: (err: Error | null, object: CookieJar) => void,
165
+ ): void;
166
+
167
+ static deserializeSync(serialized: CookieJar.Serialized | string, store?: Store): CookieJar;
168
+
169
+ static fromJSON(string: string): CookieJar;
170
+
171
+ constructor(store?: Store, options?: CookieJar.Options);
172
+
173
+ setCookie(
174
+ cookieOrString: Cookie | string,
175
+ currentUrl: string,
176
+ options?: CookieJar.SetCookieOptions,
177
+ ): Promise<Cookie>;
178
+ setCookie(
179
+ cookieOrString: Cookie | string,
180
+ currentUrl: string,
181
+ options: CookieJar.SetCookieOptions,
182
+ cb: (err: Error | null, cookie: Cookie) => void,
183
+ ): void;
184
+ setCookie(
185
+ cookieOrString: Cookie | string,
186
+ currentUrl: string,
187
+ cb: (err: Error | null, cookie: Cookie) => void,
188
+ ): void;
189
+
190
+ setCookieSync(cookieOrString: Cookie | string, currentUrl: string, options?: CookieJar.SetCookieOptions): Cookie;
191
+
192
+ getCookies(currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<Cookie[]>;
193
+ getCookies(
194
+ currentUrl: string,
195
+ options: CookieJar.GetCookiesOptions,
196
+ cb: (err: Error | null, cookies: Cookie[]) => void,
197
+ ): void;
198
+ getCookies(currentUrl: string, cb: (err: Error | null, cookies: Cookie[]) => void): void;
199
+
200
+ getCookiesSync(currentUrl: string, options?: CookieJar.GetCookiesOptions): Cookie[];
201
+
202
+ getCookieString(currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<string>;
203
+ getCookieString(
204
+ currentUrl: string,
205
+ options: CookieJar.GetCookiesOptions,
206
+ cb: (err: Error | null, cookies: string) => void,
207
+ ): void;
208
+ getCookieString(currentUrl: string, cb: (err: Error | null, cookies: string) => void): void;
209
+
210
+ getCookieStringSync(currentUrl: string, options?: CookieJar.GetCookiesOptions): string;
211
+
212
+ getSetCookieStrings(currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<string[]>;
213
+ getSetCookieStrings(
214
+ currentUrl: string,
215
+ options: CookieJar.GetCookiesOptions,
216
+ cb: (err: Error | null, cookies: string[]) => void,
217
+ ): void;
218
+ getSetCookieStrings(currentUrl: string, cb: (err: Error | null, cookies: string[]) => void): void;
219
+
220
+ getSetCookieStringsSync(currentUrl: string, options?: CookieJar.GetCookiesOptions): string[];
221
+
222
+ serialize(): Promise<CookieJar.Serialized>;
223
+ serialize(cb: (err: Error | null, serializedObject: CookieJar.Serialized) => void): void;
224
+
225
+ serializeSync(): CookieJar.Serialized;
226
+
227
+ toJSON(): CookieJar.Serialized;
228
+
229
+ clone(store?: Store): Promise<CookieJar>;
230
+ clone(store: Store, cb: (err: Error | null, newJar: CookieJar) => void): void;
231
+ clone(cb: (err: Error | null, newJar: CookieJar) => void): void;
232
+
233
+ cloneSync(store?: Store): CookieJar;
234
+
235
+ removeAllCookies(): Promise<void>;
236
+ removeAllCookies(cb: (err: Error | null) => void): void;
237
+
238
+ removeAllCookiesSync(): void;
239
+ }
240
+
241
+ export namespace CookieJar {
242
+ interface Options {
243
+ allowSpecialUseDomain?: boolean | undefined;
244
+ looseMode?: boolean | undefined;
245
+ rejectPublicSuffixes?: boolean | undefined;
246
+ prefixSecurity?: string | undefined;
247
+ }
248
+
249
+ interface SetCookieOptions {
250
+ http?: boolean | undefined;
251
+ secure?: boolean | undefined;
252
+ now?: Date | undefined;
253
+ ignoreError?: boolean | undefined;
254
+ }
255
+
256
+ interface GetCookiesOptions {
257
+ http?: boolean | undefined;
258
+ secure?: boolean | undefined;
259
+ now?: Date | undefined;
260
+ expire?: boolean | undefined;
261
+ allPaths?: boolean | undefined;
262
+ }
263
+
264
+ interface Serialized {
265
+ version: string;
266
+ storeType: string;
267
+ rejectPublicSuffixes: boolean;
268
+ cookies: Cookie.Serialized[];
269
+ }
270
+ }
271
+
272
+ export abstract class Store {
273
+ synchronous: boolean;
274
+
275
+ findCookie(domain: string, path: string, key: string, cb: (err: Error | null, cookie: Cookie | null) => void): void;
276
+
277
+ findCookies(
278
+ domain: string,
279
+ path: string,
280
+ allowSpecialUseDomain: boolean,
281
+ cb: (err: Error | null, cookie: Cookie[]) => void,
282
+ ): void;
283
+
284
+ putCookie(cookie: Cookie, cb: (err: Error | null) => void): void;
285
+
286
+ updateCookie(oldCookie: Cookie, newCookie: Cookie, cb: (err: Error | null) => void): void;
287
+
288
+ removeCookie(domain: string, path: string, key: string, cb: (err: Error | null) => void): void;
289
+
290
+ removeCookies(domain: string, path: string, cb: (err: Error | null) => void): void;
291
+
292
+ getAllCookies(cb: (err: Error | null, cookie: Cookie[]) => void): void;
293
+ }
294
+
295
+ export class MemoryCookieStore extends Store {
296
+ findCookie(domain: string, path: string, key: string, cb: (err: Error | null, cookie: Cookie | null) => void): void;
297
+ findCookie(domain: string, path: string, key: string): Promise<Cookie | null>;
298
+
299
+ findCookies(
300
+ domain: string,
301
+ path: string,
302
+ allowSpecialUseDomain: boolean,
303
+ cb: (err: Error | null, cookie: Cookie[]) => void,
304
+ ): void;
305
+ findCookies(domain: string, path: string, cb: (err: Error | null, cookie: Cookie[]) => void): void;
306
+ findCookies(domain: string, path: string, allowSpecialUseDomain?: boolean): Promise<Cookie[]>;
307
+
308
+ putCookie(cookie: Cookie, cb: (err: Error | null) => void): void;
309
+ putCookie(cookie: Cookie): Promise<void>;
310
+
311
+ updateCookie(oldCookie: Cookie, newCookie: Cookie, cb: (err: Error | null) => void): void;
312
+ updateCookie(oldCookie: Cookie, newCookie: Cookie): Promise<void>;
313
+
314
+ removeCookie(domain: string, path: string, key: string, cb: (err: Error | null) => void): void;
315
+ removeCookie(domain: string, path: string, key: string): Promise<void>;
316
+
317
+ removeCookies(domain: string, path: string, cb: (err: Error | null) => void): void;
318
+ removeCookies(domain: string, path: string): Promise<void>;
319
+
320
+ getAllCookies(cb: (err: Error | null, cookie: Cookie[]) => void): void;
321
+ getAllCookies(): Promise<Cookie[]>;
322
+ }
323
+ }
324
+
325
+ declare module "@distube/ytdl-core" {
326
+ import { Dispatcher, ProxyAgent, request } from "undici";
327
+ import { Cookie as CK, CookieJar } from "tough-cookie";
328
+ import { CookieAgent } from "http-cookie-agent/undici";
329
+ import { Readable } from "stream";
330
+
331
+ namespace ytdl {
332
+ type Filter =
333
+ | "audioandvideo"
334
+ | "videoandaudio"
335
+ | "video"
336
+ | "videoonly"
337
+ | "audio"
338
+ | "audioonly"
339
+ | ((format: videoFormat) => boolean);
340
+
341
+ interface Agent {
342
+ dispatcher: Dispatcher;
343
+ jar: CookieJar;
344
+ localAddress?: string;
345
+ }
346
+
347
+ interface getInfoOptions {
348
+ lang?: string;
349
+ requestCallback?: () => {};
350
+ rewriteRequest?: (
351
+ url: string,
352
+ requestOptions: Parameters<typeof request>[1],
353
+ ) => { url: string; requestOptions: Parameters<typeof request>[1] };
354
+ requestOptions?: Parameters<typeof request>[1];
355
+ agent?: Agent;
356
+ playerClients?: Array<"WEB_CREATOR" | "IOS" | "ANDROID" | "WEB">;
357
+ }
358
+
359
+ interface chooseFormatOptions {
360
+ quality?:
361
+ | "lowest"
362
+ | "highest"
363
+ | "highestaudio"
364
+ | "lowestaudio"
365
+ | "highestvideo"
366
+ | "lowestvideo"
367
+ | string
368
+ | number
369
+ | string[]
370
+ | number[];
371
+ filter?: Filter;
372
+ format?: videoFormat;
373
+ }
374
+
375
+ interface downloadOptions extends getInfoOptions, chooseFormatOptions {
376
+ range?: {
377
+ start?: number;
378
+ end?: number;
379
+ };
380
+ begin?: string | number | Date;
381
+ liveBuffer?: number;
382
+ highWaterMark?: number;
383
+ IPv6Block?: string;
384
+ dlChunkSize?: number;
385
+ }
386
+
387
+ interface videoFormat {
388
+ itag: number;
389
+ url: string;
390
+ mimeType?: string;
391
+ bitrate?: number;
392
+ audioBitrate?: number;
393
+ width?: number;
394
+ height?: number;
395
+ initRange?: { start: string; end: string };
396
+ indexRange?: { start: string; end: string };
397
+ lastModified: string;
398
+ contentLength: string;
399
+ quality: "tiny" | "small" | "medium" | "large" | "hd720" | "hd1080" | "hd1440" | "hd2160" | "highres" | string;
400
+ qualityLabel:
401
+ | "144p"
402
+ | "144p 15fps"
403
+ | "144p60 HDR"
404
+ | "240p"
405
+ | "240p60 HDR"
406
+ | "270p"
407
+ | "360p"
408
+ | "360p60 HDR"
409
+ | "480p"
410
+ | "480p60 HDR"
411
+ | "720p"
412
+ | "720p60"
413
+ | "720p60 HDR"
414
+ | "1080p"
415
+ | "1080p60"
416
+ | "1080p60 HDR"
417
+ | "1440p"
418
+ | "1440p60"
419
+ | "1440p60 HDR"
420
+ | "2160p"
421
+ | "2160p60"
422
+ | "2160p60 HDR"
423
+ | "4320p"
424
+ | "4320p60";
425
+ projectionType?: "RECTANGULAR";
426
+ fps?: number;
427
+ averageBitrate?: number;
428
+ audioQuality?: "AUDIO_QUALITY_LOW" | "AUDIO_QUALITY_MEDIUM";
429
+ colorInfo?: {
430
+ primaries: string;
431
+ transferCharacteristics: string;
432
+ matrixCoefficients: string;
433
+ };
434
+ highReplication?: boolean;
435
+ approxDurationMs?: string;
436
+ targetDurationSec?: number;
437
+ maxDvrDurationSec?: number;
438
+ audioSampleRate?: string;
439
+ audioChannels?: number;
440
+
441
+ // Added by ytdl-core
442
+ container: "flv" | "3gp" | "mp4" | "webm" | "ts";
443
+ hasVideo: boolean;
444
+ hasAudio: boolean;
445
+ codecs: string;
446
+ videoCodec?: string;
447
+ audioCodec?: string;
448
+
449
+ isLive: boolean;
450
+ isHLS: boolean;
451
+ isDashMPD: boolean;
452
+ }
453
+
454
+ interface thumbnail {
455
+ url: string;
456
+ width: number;
457
+ height: number;
458
+ }
459
+
460
+ interface captionTrack {
461
+ baseUrl: string;
462
+ name: {
463
+ simpleText:
464
+ | "Afrikaans"
465
+ | "Albanian"
466
+ | "Amharic"
467
+ | "Arabic"
468
+ | "Armenian"
469
+ | "Azerbaijani"
470
+ | "Bangla"
471
+ | "Basque"
472
+ | "Belarusian"
473
+ | "Bosnian"
474
+ | "Bulgarian"
475
+ | "Burmese"
476
+ | "Catalan"
477
+ | "Cebuano"
478
+ | "Chinese (Simplified)"
479
+ | "Chinese (Traditional)"
480
+ | "Corsican"
481
+ | "Croatian"
482
+ | "Czech"
483
+ | "Danish"
484
+ | "Dutch"
485
+ | "English"
486
+ | "English (auto-generated)"
487
+ | "Esperanto"
488
+ | "Estonian"
489
+ | "Filipino"
490
+ | "Finnish"
491
+ | "French"
492
+ | "Galician"
493
+ | "Georgian"
494
+ | "German"
495
+ | "Greek"
496
+ | "Gujarati"
497
+ | "Haitian Creole"
498
+ | "Hausa"
499
+ | "Hawaiian"
500
+ | "Hebrew"
501
+ | "Hindi"
502
+ | "Hmong"
503
+ | "Hungarian"
504
+ | "Icelandic"
505
+ | "Igbo"
506
+ | "Indonesian"
507
+ | "Irish"
508
+ | "Italian"
509
+ | "Japanese"
510
+ | "Javanese"
511
+ | "Kannada"
512
+ | "Kazakh"
513
+ | "Khmer"
514
+ | "Korean"
515
+ | "Kurdish"
516
+ | "Kyrgyz"
517
+ | "Lao"
518
+ | "Latin"
519
+ | "Latvian"
520
+ | "Lithuanian"
521
+ | "Luxembourgish"
522
+ | "Macedonian"
523
+ | "Malagasy"
524
+ | "Malay"
525
+ | "Malayalam"
526
+ | "Maltese"
527
+ | "Maori"
528
+ | "Marathi"
529
+ | "Mongolian"
530
+ | "Nepali"
531
+ | "Norwegian"
532
+ | "Nyanja"
533
+ | "Pashto"
534
+ | "Persian"
535
+ | "Polish"
536
+ | "Portuguese"
537
+ | "Punjabi"
538
+ | "Romanian"
539
+ | "Russian"
540
+ | "Samoan"
541
+ | "Scottish Gaelic"
542
+ | "Serbian"
543
+ | "Shona"
544
+ | "Sindhi"
545
+ | "Sinhala"
546
+ | "Slovak"
547
+ | "Slovenian"
548
+ | "Somali"
549
+ | "Southern Sotho"
550
+ | "Spanish"
551
+ | "Spanish (Spain)"
552
+ | "Sundanese"
553
+ | "Swahili"
554
+ | "Swedish"
555
+ | "Tajik"
556
+ | "Tamil"
557
+ | "Telugu"
558
+ | "Thai"
559
+ | "Turkish"
560
+ | "Ukrainian"
561
+ | "Urdu"
562
+ | "Uzbek"
563
+ | "Vietnamese"
564
+ | "Welsh"
565
+ | "Western Frisian"
566
+ | "Xhosa"
567
+ | "Yiddish"
568
+ | "Yoruba"
569
+ | "Zulu"
570
+ | string;
571
+ };
572
+ vssId: string;
573
+ languageCode:
574
+ | "af"
575
+ | "sq"
576
+ | "am"
577
+ | "ar"
578
+ | "hy"
579
+ | "az"
580
+ | "bn"
581
+ | "eu"
582
+ | "be"
583
+ | "bs"
584
+ | "bg"
585
+ | "my"
586
+ | "ca"
587
+ | "ceb"
588
+ | "zh-Hans"
589
+ | "zh-Hant"
590
+ | "co"
591
+ | "hr"
592
+ | "cs"
593
+ | "da"
594
+ | "nl"
595
+ | "en"
596
+ | "eo"
597
+ | "et"
598
+ | "fil"
599
+ | "fi"
600
+ | "fr"
601
+ | "gl"
602
+ | "ka"
603
+ | "de"
604
+ | "el"
605
+ | "gu"
606
+ | "ht"
607
+ | "ha"
608
+ | "haw"
609
+ | "iw"
610
+ | "hi"
611
+ | "hmn"
612
+ | "hu"
613
+ | "is"
614
+ | "ig"
615
+ | "id"
616
+ | "ga"
617
+ | "it"
618
+ | "ja"
619
+ | "jv"
620
+ | "kn"
621
+ | "kk"
622
+ | "km"
623
+ | "ko"
624
+ | "ku"
625
+ | "ky"
626
+ | "lo"
627
+ | "la"
628
+ | "lv"
629
+ | "lt"
630
+ | "lb"
631
+ | "mk"
632
+ | "mg"
633
+ | "ms"
634
+ | "ml"
635
+ | "mt"
636
+ | "mi"
637
+ | "mr"
638
+ | "mn"
639
+ | "ne"
640
+ | "no"
641
+ | "ny"
642
+ | "ps"
643
+ | "fa"
644
+ | "pl"
645
+ | "pt"
646
+ | "pa"
647
+ | "ro"
648
+ | "ru"
649
+ | "sm"
650
+ | "gd"
651
+ | "sr"
652
+ | "sn"
653
+ | "sd"
654
+ | "si"
655
+ | "sk"
656
+ | "sl"
657
+ | "so"
658
+ | "st"
659
+ | "es"
660
+ | "su"
661
+ | "sw"
662
+ | "sv"
663
+ | "tg"
664
+ | "ta"
665
+ | "te"
666
+ | "th"
667
+ | "tr"
668
+ | "uk"
669
+ | "ur"
670
+ | "uz"
671
+ | "vi"
672
+ | "cy"
673
+ | "fy"
674
+ | "xh"
675
+ | "yi"
676
+ | "yo"
677
+ | "zu"
678
+ | string;
679
+ kind: string;
680
+ rtl?: boolean;
681
+ isTranslatable: boolean;
682
+ }
683
+
684
+ interface audioTrack {
685
+ captionTrackIndices: number[];
686
+ }
687
+
688
+ interface translationLanguage {
689
+ languageCode: captionTrack["languageCode"];
690
+ languageName: captionTrack["name"];
691
+ }
692
+
693
+ interface VideoDetails {
694
+ videoId: string;
695
+ title: string;
696
+ shortDescription: string;
697
+ lengthSeconds: string;
698
+ keywords?: string[];
699
+ channelId: string;
700
+ isOwnerViewing: boolean;
701
+ isCrawlable: boolean;
702
+ thumbnails: thumbnail[];
703
+ averageRating: number;
704
+ allowRatings: boolean;
705
+ viewCount: string;
706
+ author: string;
707
+ isPrivate: boolean;
708
+ isUnpluggedCorpus: boolean;
709
+ isLiveContent: boolean;
710
+ isLive: boolean;
711
+ }
712
+
713
+ interface Media {
714
+ category: string;
715
+ category_url: string;
716
+ game?: string;
717
+ game_url?: string;
718
+ year?: number;
719
+ song?: string;
720
+ artist?: string;
721
+ artist_url?: string;
722
+ writers?: string;
723
+ licensed_by?: string;
724
+ thumbnails: thumbnail[];
725
+ }
726
+
727
+ interface Author {
728
+ id: string;
729
+ name: string;
730
+ avatar: string; // to remove later
731
+ thumbnails?: thumbnail[];
732
+ verified: boolean;
733
+ user?: string;
734
+ channel_url: string;
735
+ external_channel_url?: string;
736
+ user_url?: string;
737
+ subscriber_count?: number;
738
+ }
739
+
740
+ interface MicroformatRenderer {
741
+ thumbnail: {
742
+ thumbnails: thumbnail[];
743
+ };
744
+ embed: {
745
+ iframeUrl: string;
746
+ flashUrl: string;
747
+ width: number;
748
+ height: number;
749
+ flashSecureUrl: string;
750
+ };
751
+ title: {
752
+ simpleText: string;
753
+ };
754
+ description: {
755
+ simpleText: string;
756
+ };
757
+ lengthSeconds: string;
758
+ ownerProfileUrl: string;
759
+ ownerGplusProfileUrl?: string;
760
+ externalChannelId: string;
761
+ isFamilySafe: boolean;
762
+ availableCountries: string[];
763
+ isUnlisted: boolean;
764
+ hasYpcMetadata: boolean;
765
+ viewCount: string;
766
+ category: string;
767
+ publishDate: string;
768
+ ownerChannelName: string;
769
+ liveBroadcastDetails?: {
770
+ isLiveNow: boolean;
771
+ startTimestamp: string;
772
+ endTimestamp?: string;
773
+ };
774
+ uploadDate: string;
775
+ }
776
+
777
+ interface storyboard {
778
+ templateUrl: string;
779
+ thumbnailWidth: number;
780
+ thumbnailHeight: number;
781
+ thumbnailCount: number;
782
+ interval: number;
783
+ columns: number;
784
+ rows: number;
785
+ storyboardCount: number;
786
+ }
787
+
788
+ interface Chapter {
789
+ title: string;
790
+ start_time: number;
791
+ }
792
+
793
+ interface MoreVideoDetails
794
+ extends Omit<VideoDetails, "author" | "thumbnail" | "shortDescription">,
795
+ Omit<MicroformatRenderer, "title" | "description"> {
796
+ published: number;
797
+ video_url: string;
798
+ age_restricted: boolean;
799
+ likes: number | null;
800
+ media: Media;
801
+ author: Author;
802
+ thumbnails: thumbnail[];
803
+ storyboards: storyboard[];
804
+ chapters: Chapter[];
805
+ description: string | null;
806
+ }
807
+
808
+ interface videoInfo {
809
+ iv_load_policy?: string;
810
+ iv_allow_in_place_switch?: string;
811
+ iv_endscreen_url?: string;
812
+ iv_invideo_url?: string;
813
+ iv3_module?: string;
814
+ rmktEnabled?: string;
815
+ uid?: string;
816
+ vid?: string;
817
+ focEnabled?: string;
818
+ baseUrl?: string;
819
+ storyboard_spec?: string;
820
+ serialized_ad_ux_config?: string;
821
+ player_error_log_fraction?: string;
822
+ sffb?: string;
823
+ ldpj?: string;
824
+ videostats_playback_base_url?: string;
825
+ innertube_context_client_version?: string;
826
+ t?: string;
827
+ fade_in_start_milliseconds: string;
828
+ timestamp: string;
829
+ ad3_module: string;
830
+ relative_loudness: string;
831
+ allow_below_the_player_companion: string;
832
+ eventid: string;
833
+ token: string;
834
+ atc: string;
835
+ cr: string;
836
+ apply_fade_on_midrolls: string;
837
+ cl: string;
838
+ fexp: string[];
839
+ apiary_host: string;
840
+ fade_in_duration_milliseconds: string;
841
+ fflags: string;
842
+ ssl: string;
843
+ pltype: string;
844
+ enabled_engage_types: string;
845
+ hl: string;
846
+ is_listed: string;
847
+ gut_tag: string;
848
+ apiary_host_firstparty: string;
849
+ enablecsi: string;
850
+ csn: string;
851
+ status: string;
852
+ afv_ad_tag: string;
853
+ idpj: string;
854
+ sfw_player_response: string;
855
+ account_playback_token: string;
856
+ encoded_ad_safety_reason: string;
857
+ tag_for_children_directed: string;
858
+ no_get_video_log: string;
859
+ ppv_remarketing_url: string;
860
+ fmt_list: string[][];
861
+ ad_slots: string;
862
+ fade_out_duration_milliseconds: string;
863
+ instream_long: string;
864
+ allow_html5_ads: string;
865
+ core_dbp: string;
866
+ ad_device: string;
867
+ itct: string;
868
+ root_ve_type: string;
869
+ excluded_ads: string;
870
+ aftv: string;
871
+ loeid: string;
872
+ cver: string;
873
+ shortform: string;
874
+ dclk: string;
875
+ csi_page_type: string;
876
+ ismb: string;
877
+ gpt_migration: string;
878
+ loudness: string;
879
+ ad_tag: string;
880
+ of: string;
881
+ probe_url: string;
882
+ vm: string;
883
+ afv_ad_tag_restricted_to_instream: string;
884
+ gapi_hint_params: string;
885
+ cid: string;
886
+ c: string;
887
+ oid: string;
888
+ ptchn: string;
889
+ as_launched_in_country: string;
890
+ avg_rating: string;
891
+ fade_out_start_milliseconds: string;
892
+ midroll_prefetch_size: string;
893
+ allow_ratings: string;
894
+ thumbnail_url: string;
895
+ iurlsd: string;
896
+ iurlmq: string;
897
+ iurlhq: string;
898
+ iurlmaxres: string;
899
+ ad_preroll: string;
900
+ tmi: string;
901
+ trueview: string;
902
+ host_language: string;
903
+ innertube_api_key: string;
904
+ show_content_thumbnail: string;
905
+ afv_instream_max: string;
906
+ innertube_api_version: string;
907
+ mpvid: string;
908
+ allow_embed: string;
909
+ ucid: string;
910
+ plid: string;
911
+ midroll_freqcap: string;
912
+ ad_logging_flag: string;
913
+ ptk: string;
914
+ vmap: string;
915
+ watermark: string[];
916
+ dbp: string;
917
+ ad_flags: string;
918
+ html5player: string;
919
+ formats: videoFormat[];
920
+ related_videos: relatedVideo[];
921
+ no_embed_allowed?: boolean;
922
+ player_response: {
923
+ playabilityStatus: {
924
+ status: string;
925
+ playableInEmbed: boolean;
926
+ miniplayer: {
927
+ miniplayerRenderer: {
928
+ playbackMode: string;
929
+ };
930
+ };
931
+ contextParams: string;
932
+ };
933
+ streamingData: {
934
+ expiresInSeconds: string;
935
+ formats: {}[];
936
+ adaptiveFormats: {}[];
937
+ };
938
+ captions?: {
939
+ playerCaptionsRenderer: {
940
+ baseUrl: string;
941
+ visibility: string;
942
+ };
943
+ playerCaptionsTracklistRenderer: {
944
+ captionTracks: captionTrack[];
945
+ audioTracks: audioTrack[];
946
+ translationLanguages: translationLanguage[];
947
+ defaultAudioTrackIndex: number;
948
+ };
949
+ };
950
+ microformat: {
951
+ playerMicroformatRenderer: MicroformatRenderer;
952
+ };
953
+ videoDetails: VideoDetails;
954
+ playerConfig: {
955
+ audioConfig: {
956
+ loudnessDb: number;
957
+ perceptualLoudnessDb: number;
958
+ enablePerFormatLoudness: boolean;
959
+ };
960
+ streamSelectionConfig: { maxBitrate: string };
961
+ mediaCommonConfig: { dynamicReadaheadConfig: {}[] };
962
+ webPlayerConfig: { webPlayerActionsPorting: {}[] };
963
+ };
964
+ };
965
+ videoDetails: MoreVideoDetails;
966
+ }
967
+
968
+ interface relatedVideo {
969
+ id?: string;
970
+ title?: string;
971
+ published?: string;
972
+ author: Author | "string"; // to remove the `string` part later
973
+ ucid?: string; // to remove later
974
+ author_thumbnail?: string; // to remove later
975
+ short_view_count_text?: string;
976
+ view_count?: string;
977
+ length_seconds?: number;
978
+ video_thumbnail?: string; // to remove later
979
+ thumbnails: thumbnail[];
980
+ richThumbnails: thumbnail[];
981
+ isLive: boolean;
982
+ }
983
+
984
+ interface Cookie {
985
+ name: string;
986
+ value: string;
987
+ expirationDate?: number;
988
+ domain?: string;
989
+ path?: string;
990
+ secure?: boolean;
991
+ httpOnly?: boolean;
992
+ hostOnly?: boolean;
993
+ sameSite?: string;
994
+ }
995
+
996
+ function getBasicInfo(url: string, options?: getInfoOptions): Promise<videoInfo>;
997
+ function getInfo(url: string, options?: getInfoOptions): Promise<videoInfo>;
998
+ function downloadFromInfo(info: videoInfo, options?: downloadOptions): Readable;
999
+ function chooseFormat(format: videoFormat | videoFormat[], options?: chooseFormatOptions): videoFormat | never;
1000
+ function filterFormats(formats: videoFormat | videoFormat[], filter?: Filter): videoFormat[];
1001
+ function validateID(string: string): boolean;
1002
+ function validateURL(string: string): boolean;
1003
+ function getURLVideoID(string: string): string | never;
1004
+ function getVideoID(string: string): string | never;
1005
+ function createProxyAgent(options: ProxyAgent.Options | string): Agent;
1006
+ function createProxyAgent(options: ProxyAgent.Options | string, cookies?: (Cookie | CK)[]): Agent;
1007
+ function createAgent(): Agent;
1008
+ function createAgent(cookies?: (Cookie | CK)[]): Agent;
1009
+ function createAgent(cookies?: (Cookie | CK)[], opts?: CookieAgent.Options): Agent;
1010
+ const version: number;
1011
+ }
1012
+
1013
+ function ytdl(link: string, options?: ytdl.downloadOptions): Readable;
1014
+
1015
+ export = ytdl;
1016
+ }