Closed mh4ck closed 4 years ago
what are you passing to ytdl.downloadFromInfo()
? it expects the info
retrieved from ytdl.getInfo()
Sure, it is from getInfo().
I forgot to mention that this happen only 1:100 and not with the same video so i don't know if we really need to fix this. But i need to catch it. :)
I investigated a bit and found out it comes from the miniget doDownload method. It seems to have a problem to get the correct format.url from the info object.
I added a check for the format.url and hope this prevent the script to stop.
/**
* Try to fix ERR_INVALID_ARG_TYPE error while check if a format url is given.
*/
let format = ytdl.filterFormats(info.formats, reqOpts.filter);
if(format.length == 0 || typeof format[0].url == "undefined") {
console.log(colors.dim("[" + doc._id + "]: Format url not found - try again."));
setTimeout(() => {
exports.download(doc, cb);
}, 1000);
return;
}
ytdl.downloadFromInfo(info, reqOpts)
.on('response', (res) => {...
cool. can you log the entire format
object too?
I'm having the same problem. Was able to log entire format object:
{
mimeType: 'video/mp4; codecs="avc1.42001E, mp4a.40.2"',
qualityLabel: '360p',
bitrate: 302604,
audioBitrate: 96,
itag: 18,
width: 640,
height: 360,
lastModified: '1579202812745067',
contentLength: '7686268',
quality: 'medium',
projectionType: 'RECTANGULAR',
averageBitrate: 302509,
audioQuality: 'AUDIO_QUALITY_LOW',
approxDurationMs: '203267',
audioSampleRate: '44100',
audioChannels: 2,
signatureCipher: 's=cwbaK6y6H8h71_Vx2jp79NswoVQd0evV_Pk-vKWbkNHICg7b7_3ZAhdgif2is7uMrzzUPtfZil90CVYPByhTbesIgIARw8JQ0qO11&sp=sig&url=https://r4---sn-xap5-ixas.googlevideo.com/videoplayback%3Fexpire%3D1588865668%26ei%3DJNazXr3IIo65yQWP4rCADQ%26ip%3D85.156.138.48%26id%3Do-AEc9jxBTRDVRj7q6oak2SxPh2Gg3kp8mAqPbQ5ibIELu%26itag%3D18%26source%3Dyoutube%26requiressl%3Dyes%26mh%3Dbb%26mm%3D31%252C29%26mn%3Dsn-xap5-ixas%252Csn-5go7yne6%26ms%3Dau%252Crdu%26mv%3Dm%26mvi%3D3%26pl%3D16%26gcr%3Dfi%26initcwndbps%3D1231250%26vprv%3D1%26mime%3Dvideo%252Fmp4%26gir%3Dyes%26clen%3D7686268%26ratebypass%3Dyes%26dur%3D203.267%26lmt%3D1579202812745067%26mt%3D1588844015%26fvip%3D4%26c%3DWEB%26txp%3D5531432%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cgcr%252Cvprv%252Cmime%252Cgir%252Cclen%252Cratebypass%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAG3C_xAwRAIgBhgV_QzElrgZ5RBktiHTQbe3TQ5rPf0Pa2_G_3reKckCIHcChqTxP1WjZSC-bLKP5MpM7ckZTSVzveWDIar11Mo3',
container: 'mp4',
codecs: 'avc1.42001E, mp4a.40.2',
live: false,
isHLS: false,
isDashMPD: false
}
As u can probably see there is no url property at all.
I also got this problem but I was not using ytdl.downloadFromInfo()
. I only use ytdl(...)
for getting YouTube ReadableStream
. It just randomly happen (at least I cannot see the pattern yet). What can I do? I cannot solve this issue and I don't know what to do.
Im also getting this error (i mostly use getInfo), quite a lot, though i can't reproduce this consecutively, sadly. it seems to happen often with this one "https://www.youtube.com/watch?v=RbM38a5ev-c", but not always. (its just a random link i picked for debugging and produced this error the most of the links i tried)
It does, however, happen more often when im not using breakpoints to check the url throughout ytdl, or only happens when i don't do that. It also seems to happen more often when doing a youtube search before using ytdl.getInfo So it might be related to ratelimits preventing very quick requests from the same ip? Hopefully you can get a better understanding of the issue with this information?
Also the pull request that is mentioned above #620 doesnt really "fix" the issue, it just moves / catches it before it crashes the whole process. which is better, not really a good solution?
Also getting this missing url property issue randomly with ytdl.getInfo()
, can be reproduced with enough attempts, sometimes happens on the first run so I wonder if it's a blanket rate limit rather than specific IPs.
Put in a similar catch as this post otherwise it crashes if passed to ytdl.downloadFromInfo()
uncaught.
Also happens with just ytdl()
I was able to trace the error back to where it occurs and where url should be received but in reality comes out as undefined.
in info.js at line 125
const url = urllib.format({ protocol: 'https', host: INFO_HOST, pathname: INFO_PATH, query: { video_id: id, eurl: VIDEO_EURL + id, ps: 'default', gl: 'US', hl: options.lang || 'en', sts: config.sts, }, });
retruns undefined so the url is undefined and causes the error
i see that this same method/function is used by ytdl.getInfo() and ytdl(). Didn't check all of the functions which use this tho.
edit: Actually i was mistaken. I have confirmed that the url is given undefined in index.js at line 8 too.
I'm having the same problem. Was able to log entire format object:
{ mimeType: 'video/mp4; codecs="avc1.42001E, mp4a.40.2"', qualityLabel: '360p', bitrate: 302604, audioBitrate: 96, itag: 18, width: 640, height: 360, lastModified: '1579202812745067', contentLength: '7686268', quality: 'medium', projectionType: 'RECTANGULAR', averageBitrate: 302509, audioQuality: 'AUDIO_QUALITY_LOW', approxDurationMs: '203267', audioSampleRate: '44100', audioChannels: 2, signatureCipher: 's=cwbaK6y6H8h71_Vx2jp79NswoVQd0evV_Pk-vKWbkNHICg7b7_3ZAhdgif2is7uMrzzUPtfZil90CVYPByhTbesIgIARw8JQ0qO11&sp=sig&url=https://r4---sn-xap5-ixas.googlevideo.com/videoplayback%3Fexpire%3D1588865668%26ei%3DJNazXr3IIo65yQWP4rCADQ%26ip%3D85.156.138.48%26id%3Do-AEc9jxBTRDVRj7q6oak2SxPh2Gg3kp8mAqPbQ5ibIELu%26itag%3D18%26source%3Dyoutube%26requiressl%3Dyes%26mh%3Dbb%26mm%3D31%252C29%26mn%3Dsn-xap5-ixas%252Csn-5go7yne6%26ms%3Dau%252Crdu%26mv%3Dm%26mvi%3D3%26pl%3D16%26gcr%3Dfi%26initcwndbps%3D1231250%26vprv%3D1%26mime%3Dvideo%252Fmp4%26gir%3Dyes%26clen%3D7686268%26ratebypass%3Dyes%26dur%3D203.267%26lmt%3D1579202812745067%26mt%3D1588844015%26fvip%3D4%26c%3DWEB%26txp%3D5531432%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cgcr%252Cvprv%252Cmime%252Cgir%252Cclen%252Cratebypass%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAG3C_xAwRAIgBhgV_QzElrgZ5RBktiHTQbe3TQ5rPf0Pa2_G_3reKckCIHcChqTxP1WjZSC-bLKP5MpM7ckZTSVzveWDIar11Mo3', container: 'mp4', codecs: 'avc1.42001E, mp4a.40.2', live: false, isHLS: false, isDashMPD: false }
As u can probably see there is no url property at all.
hmm, looks like we've got ourselves a new format to contend with. this is a stretch but, can you try using the new-endpoint
branch and see if this error occurs there?
otherwise, this could be difficult to figure out.
actually, just looked at it a bit more closely, the url is in there in the signatureDecipher
prop. should be a quick fix.
if you're wondering if the cipher
prop still shows up, I checked a few videos and it does. so ytdl-core is going to be checking for both cipher
and signatureCipher
.
Sounds great! Would u like me to test using the new-endpoint branch? or will you just be able to fix it now?
no need to test new-endpoint
branch anymore
no need to test
new-endpoint
branch anymore
But url is not invalid
"signatureCipher":"s=gkOq0QJ8wRAIgQEI69i_SQ8GT9Ck34372ry7JlecaTvBAZmm7H_ouUmwCID54qEEMrI7NwPSnIDNGNLC95uqRGVV0Zc5nIGSlnCwewe&sp=sig&url=https://r1---sn-8pxuuxa-i5oek.googlevideo.com/videoplayback%3Fexpire%3D1590648467%26ei%3DMwrPXrCwG_G5igaN0LeoDg%26ip%3D2402%253A800%253A610d%253A6315%253A9012%253A3d6f%253A54b9%253A36f0%26id%3Do-AIRzJwRPtR1Th_-pj5lGXoUGNSO2mjsGOEfCF0ZgM1OM%26itag%3D18%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DX4%26mm%3D31%252C29%26mn%3Dsn-8pxuuxa-i5oek%252Csn-8pxuuxa-i5ozz%26ms%3Dau%252Crdu%26mv%3Dm%26mvi%3D0%26pl%3D48%26pcm2%3Dyes%26initcwndbps%3D1360000%26vprv%3D1%26mime%3Dvideo%252Fmp4%26gir%3Dyes%26clen%3D16070996%26ratebypass%3Dyes%26dur%3D236.472%26lmt%3D1580553547938746%26mt%3D1590626014%26fvip%3D1%26c%3DWEB%26txp%3D5531432%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cpcm2%252Cvprv%252Cmime%252Cgir%252Cclen%252Cratebypass%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAG3C_xAwRQIhAOf8iGpKBiGXw_ypioycG-AkhVo5L4HZYPBQQO6WNGAEAiAYoWvXh1xFpNNhEJdelpUbLLZ_PWe8gL9mubJoGVeNeg%253D%253D",
I been having this issue for the past few days, it happens a lot and makes the entire app just crash... any fix yet?
internal/validators.js:117 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined at validateString (internal/validators.js:117:11) at Url.parse (url.js:159:3) at Object.urlParse [as parse] (url.js:154:13) at doDownload (/var/www/html/discordvoice/node_modules/miniget/dist/index.js:90:28) at processTicksAndRejections (internal/process/task_queues.js:79:11) { code: 'ERR_INVALID_ARG_TYPE' }
I'm having the same issue here, any fix? am using ytdl-core
Update ur ytdl and it will be fixed
after updating ytdl-core the error message changed to TypeError: Cannot read property 'player_response' of undefined
Thats something with your code most likely
I switched from ytdl(...) to ytdl.downloadFromInfo and suddenly i got an error like this:
How can i catch this?