mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-14 01:08:27 +00:00
fix: youtube stream failing midway
This commit is contained in:
parent
0d868e0bd3
commit
c73beab5ba
@ -33,6 +33,6 @@
|
||||
"node-cache": "^5.1.2",
|
||||
"url-pattern": "1.0.3",
|
||||
"xml-js": "^1.6.11",
|
||||
"youtubei.js": "4.1.1"
|
||||
"youtubei.js": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { spawn } from "child_process";
|
||||
import { Constants as YTConstants } from "youtubei.js";
|
||||
import { Constants as YTConstants, Utils } from "youtubei.js";
|
||||
import ffmpeg from "ffmpeg-static";
|
||||
import got from "got";
|
||||
import { ffmpegArgs, genericUserAgent } from "../config.js";
|
||||
@ -63,7 +63,8 @@ function createYoutubeStream(format_url) {
|
||||
|
||||
const chunk = got.get(`${format_url}&range=${chunk_start}-${chunk_end || ''}`, {
|
||||
headers: {
|
||||
...YTConstants.STREAM_HEADERS
|
||||
...YTConstants.STREAM_HEADERS,
|
||||
'User-Agent': Utils.getRandomUserAgent('desktop'),
|
||||
},
|
||||
isStream: true,
|
||||
responseType: 'buffer',
|
||||
|
Loading…
Reference in New Issue
Block a user