node-ytdl-core
node-ytdl-core copied to clipboard
getBasicInfo() - No url entry for some videos
I was trying to get basic info for different songs with (stripped to it's core) this following snippet
ytdl.getBasicInfo("https://www.youtube.com/watch?v=RRv6s_ChTw4")
.then((info) => {
console.log(info);
});
The snippet does work with some videos such as "https://www.youtube.com/watch?v=04GiqLjRO3A" but it 'fails' for a lot of other videos such as for the one in the code snippet. By failing I mean that it does not create url entries for any format but instead only the signatureCipher entry. The url inside of this property however does not work when opened in a browser.
The output of info as a whole looks something like this:
Object {
"formats": Array [
Object {
"approxDurationMs": "286302",
"audioChannels": 2,
"audioQuality": "AUDIO_QUALITY_LOW",
"audioSampleRate": "44100",
"averageBitrate": 443559,
"bitrate": 443666,
"contentLength": "15874008",
"fps": 30,
"height": 360,
"itag": 18,
"lastModified": "1634473583554620",
"mimeType": "video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"",
"projectionType": "RECTANGULAR",
"quality": "medium",
"qualityLabel": "360p",
"signatureCipher": "s=KWbubffAGeu2kY5GRDZuBCvDV_-wH2F9f1vuK_kn32TX9CICY3_yVqWT8LHJkFl0x0a-gMTzE_dhCiBcTUQf-TpoetHgIARwAJQ0qO88&sp=sig&url=https://rr1---sn-poxmpv-njoe.googlevideo.com/videoplayback%3Fexpire%3D1654051974%26ei%3DJoCWYq-8FZHJgQf0xKWQCw%26ip%3D<my ip>%26id%3Do-ALvmA3CgP1Y0T8TYPSf07VEDxC6PGm60mCQmyfZTcEEy%26itag%3D18%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DxW%26mm%3D31%252C29%26mn%3Dsn-poxmpv-njoe%252Csn-4g5edndz%26ms%3Dau%252Crdu%26mv%3Dm%26mvi%3D1%26pl%3D21%26initcwndbps%3D1173750%26spc%3D4ocVC6w92h89SYLzQUUDxbLtQVk2%26vprv%3D1%26mime%3Dvideo%252Fmp4%26ns%3DwmeiJRVSpYxPfQf6pMxKp3kG%26gir%3Dyes%26clen%3D15874008%26ratebypass%3Dyes%26dur%3D286.302%26lmt%3D1634473583554620%26mt%3D1654029921%26fvip%3D2%26fexp%3D24001373%252C24007246%26c%3DWEB%26txp%3D5438434%26n%3Dz7G2QaxKsKhnO4t1MOwx%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cspc%252Cvprv%252Cmime%252Cns%252Cgir%252Cclen%252Cratebypass%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAG3C_xAwRAIgJHK6b47caxNpAztzQaGcsHj_IrWcH2R74Us6Qlssq-oCIB_R1PuoH_S81puGJf8gw5-s6agJ8e8zio7RjH2X0ifE",
"width": 640,
},
After that, I cloned the repository and ran `npm run test:irl` which gave the following result:
> [email protected] test:irl
> mocha --timeout 16000 test/irl-test.js
Try using ytdl-core without mocking
Try starting a download
Regular video
✓ Request status code is 2xx (3512ms)
Age restricted
1) Request status code is 2xx
Embed domain restricted
2) Request status code is 2xx
No embed allowed
✓ Request status code is 2xx (3123ms)
Offensive
✓ Request status code is 2xx (3176ms)
Live broadcast
3) Request status code is 2xx
3 passing (28s)
3 failing
1) Try using ytdl-core without mocking
Try starting a download
Age restricted
Request status code is 2xx:
Error: Status code: 410
at ClientRequest.<anonymous> (node_modules/miniget/dist/index.js:206:27)
at Object.onceWrapper (node:events:646:26)
at ClientRequest.emit (node:events:526:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:618:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:482:22)
at TLSSocket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
2) Try using ytdl-core without mocking
Try starting a download
Embed domain restricted
Request status code is 2xx:
Error: Status code: 410
at ClientRequest.<anonymous> (node_modules/miniget/dist/index.js:206:27)
at Object.onceWrapper (node:events:646:26)
at ClientRequest.emit (node:events:526:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:618:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:482:22)
at TLSSocket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
3) Try using ytdl-core without mocking
Try starting a download
Live broadcast
Request status code is 2xx:
Error: Timeout of 16000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/osaka/Downloads/node-ytdl-core/test/irl-test.js)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
You need to use getInfo
if you want deciphered format URLs, getBasicInfo
is only for metadata. See the README for more information.
Oh, I see. Thanks for the clarification!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.