403 Errors completely fixed
This commit is contained in:
parent
9646c6d46f
commit
ed6f6bdea5
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "play-dl",
|
"name": "play-dl",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "play-dl",
|
"name": "play-dl",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"got": "^11.8.2"
|
"got": "^11.8.2"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "play-dl",
|
"name": "play-dl",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"description": "YouTube, SoundCloud, Spotify streaming for discord.js bots",
|
"description": "YouTube, SoundCloud, Spotify streaming for discord.js bots",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
|||||||
@ -43,14 +43,14 @@ export async function stream(url : string, cookie? : string): Promise<Stream | L
|
|||||||
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = await got(info.format[info.format.length - 1].url, {
|
await got(info.format[info.format.length - 1].url, {
|
||||||
headers : {
|
headers : {
|
||||||
"range" : `bytes=0-1`
|
"range" : `bytes=0-1`
|
||||||
}
|
},
|
||||||
})
|
retry : 0
|
||||||
if(response.statusCode >= 400){
|
}).catch(async () => {
|
||||||
return await stream(info.video_details.url)
|
return await stream(info.video_details.url)
|
||||||
}
|
})
|
||||||
|
|
||||||
let audioFormat = parseAudioFormats(info.format)
|
let audioFormat = parseAudioFormats(info.format)
|
||||||
let opusFormats = filterFormat(audioFormat, "opus")
|
let opusFormats = filterFormat(audioFormat, "opus")
|
||||||
@ -79,14 +79,14 @@ export async function stream_from_info(info : InfoData): Promise<Stream | LiveSt
|
|||||||
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = await got(info.format[info.format.length - 1].url, {
|
await got(info.format[info.format.length - 1].url, {
|
||||||
headers : {
|
headers : {
|
||||||
"range" : `bytes=0-1`
|
"range" : `bytes=0-1`
|
||||||
}
|
},
|
||||||
})
|
retry : 0
|
||||||
if(response.statusCode >= 400){
|
}).catch(async () => {
|
||||||
return await stream(info.video_details.url)
|
return await stream(info.video_details.url)
|
||||||
}
|
})
|
||||||
|
|
||||||
let audioFormat = parseAudioFormats(info.format)
|
let audioFormat = parseAudioFormats(info.format)
|
||||||
let opusFormats = filterFormat(audioFormat, "opus")
|
let opusFormats = filterFormat(audioFormat, "opus")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user