![]() ![]() And also we will add a small socket.io connection for a more realtime responsive application. We will be using express.js to start our server. Now that this is done, all we need is to hook up this function with the server so that I will respond to the request and send back an audio file. The function will look like this ĭon’t worry about the variable called clientGlob, I will explain what that is in a moment. We will write a function called getAudio which will take two parameters, first the url of the video and second response object which we connect later. ytdl-core has amazing documentation on their page. Please see that socket.io is an optional requirement but I have used it to make the UI furthermore responsive by sending out information from the server. npm install -save express cors ytdl-core socket.io Now let’s get the packages we need for the project. Keep everything as default as prompted by the wizard(or make changes, up to you). Run the above command on a blank directory. First, let us initialize our backend scripts so we can have a server that will handle requests. Let’s get our hands dirty and begin with the coding. Added to it, it has also the functionality of fetching video information and qualities available for download. This tiny package has the power to download videos from YouTube just by hooking it up with the URL. The magic of the web-app happens via a magical Node package called ytdl-core. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |