@mks2508/bundlp 0.1.14 → 0.1.16
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/dist/index.mjs +19 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1445,7 +1445,19 @@ var Player = class {
|
|
|
1445
1445
|
if (!playerUrl) {
|
|
1446
1446
|
const fetchUrl = videoId ? `${YOUTUBE_BASE_URL}/watch?v=${videoId}` : YOUTUBE_BASE_URL;
|
|
1447
1447
|
log$6.info(`Fetching player URL from: ${fetchUrl}`);
|
|
1448
|
-
const htmlResult = await httpClient.get(fetchUrl
|
|
1448
|
+
const htmlResult = await httpClient.get(fetchUrl, { headers: {
|
|
1449
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
1450
|
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
|
1451
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
1452
|
+
"Sec-Ch-Ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
|
|
1453
|
+
"Sec-Ch-Ua-Mobile": "?0",
|
|
1454
|
+
"Sec-Ch-Ua-Platform": "\"Windows\"",
|
|
1455
|
+
"Sec-Fetch-Dest": "document",
|
|
1456
|
+
"Sec-Fetch-Mode": "navigate",
|
|
1457
|
+
"Sec-Fetch-Site": "none",
|
|
1458
|
+
"Sec-Fetch-User": "?1",
|
|
1459
|
+
"Upgrade-Insecure-Requests": "1"
|
|
1460
|
+
} });
|
|
1449
1461
|
if (!isOk(htmlResult)) {
|
|
1450
1462
|
log$6.error("Failed to fetch page:", htmlResult.error.message);
|
|
1451
1463
|
return err(htmlResult.error);
|
|
@@ -2364,9 +2376,13 @@ var YouTubeExtractor = class {
|
|
|
2364
2376
|
}
|
|
2365
2377
|
async realExtract(videoId) {
|
|
2366
2378
|
const playerResult = await this.player.initialize(void 0, videoId);
|
|
2367
|
-
|
|
2379
|
+
let signatureTimestamp = 0;
|
|
2380
|
+
if (isOk(playerResult)) {
|
|
2381
|
+
signatureTimestamp = this.player.getSignatureTimestamp();
|
|
2382
|
+
log$5.info(`Player initialized, signatureTimestamp: ${signatureTimestamp}`);
|
|
2383
|
+
} else log$5.warn(`Player init failed (will try without): ${playerResult.error.message}`);
|
|
2368
2384
|
const responseResult = await this.client.fetchPlayerWithFallback(videoId, {
|
|
2369
|
-
signatureTimestamp
|
|
2385
|
+
signatureTimestamp,
|
|
2370
2386
|
poToken: this.config.poToken
|
|
2371
2387
|
});
|
|
2372
2388
|
if (isErr(responseResult)) return err(responseResult.error);
|