Skip to content Skip to sidebar Skip to footer

How To Get Direct Url Of Video From Youtube Url?

I'm creating a bot in Discord.JS (it's a library for Node.JS) and I would like to add a music module to it. Discord.JS can play videos in formats like .wav, .mp4 etc. in voice chan

Solution 1:

You used to be able to get it pretty easily with youtube.com/get_video?video_id=... but that was like 5+ years ago, now I think it uses some weird stream thing.

I don't think Youtube's official API lets you download videos or get a URL. Also, you should probably take a look at section 5B of the YouTube TOS

You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content.

But anyway, one method I know is youtube-dl, but I'm pretty sure it's only for python. There seem to be a few node wrappers online though (ex.)

I've also found a node.js youtube downloader, ytdl. Last update was 9 days ago so it should probably be working fine with the current system. You should be able to use -o filename or --output filename to download it, or --print-url to get a direct video url.

Solution 2:

You could use FFMPEG to download video and then play that file

Post a Comment for "How To Get Direct Url Of Video From Youtube Url?"