youtube-ext
Advanced tools
Comparing version 1.1.19 to 1.1.20
export declare class CookieJar { | ||
cookieMap: Record<string, string>; | ||
cookieHeaderValue(): string; | ||
disabled: boolean; | ||
cookieHeaderValue(): string | undefined; | ||
utilizeResponseHeaders(headers: Record<string, string | string[] | undefined>): void; | ||
@@ -5,0 +6,0 @@ static stringifyCookieMap(cookies: Record<string, string>): string; |
@@ -7,4 +7,7 @@ "use strict"; | ||
this.cookieMap = {}; | ||
this.disabled = false; | ||
} | ||
cookieHeaderValue() { | ||
if (this.disabled) | ||
return; | ||
return CookieJar.stringifyCookieMap(this.cookieMap); | ||
@@ -23,3 +26,3 @@ } | ||
return Object.entries(cookies) | ||
.map((x) => x.join("=")) | ||
.map(([k, v]) => `${k}=${encodeURIComponent(v)}`) | ||
.join("; "); | ||
@@ -36,3 +39,3 @@ } | ||
} | ||
pv[k] = v; | ||
pv[k] = decodeURIComponent(v); | ||
return pv; | ||
@@ -67,3 +70,4 @@ }, cookieMap); | ||
"gps", | ||
"priority", | ||
]; | ||
exports.cookieJar = new CookieJar(); |
@@ -52,3 +52,3 @@ "use strict"; | ||
const streamingDataRaw = (0, common_1.contentBetweenEnds)(data, '"streamingData":', [ | ||
['},"heartbeatParams":{', "}"], | ||
['},"playbackTracking":{', "}"], | ||
['}]},"', "}]}"], | ||
@@ -55,0 +55,0 @@ ]); |
@@ -17,3 +17,2 @@ "use strict"; | ||
const youtube_1 = require("./utils/youtube"); | ||
const cookies_1 = require("./cookies"); | ||
/** | ||
@@ -35,3 +34,2 @@ * Returns a YouTube stream. | ||
"User-Agent": constants_1.constants.headers.userAgent, | ||
Cookie: cookies_1.cookieJar.cookieHeaderValue(), | ||
}, | ||
@@ -38,0 +36,0 @@ }; |
{ | ||
"name": "youtube-ext", | ||
"version": "1.1.19", | ||
"version": "1.1.20", | ||
"description": "A simple YouTube scraper and downloader.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
85970
1616