-
Install Node.js:
- Visit the official Node.js website at nodejs.org
- Download and install the appropriate version for your operating system.
-
Create a new directory for your project:
- Open your preferred terminal or command prompt.
- Navigate to the desired location where you want to create the project directory.
- Run the following command to create a new directory:
mkdir youtube-downloader
-
Initialize a new Node.js project:
- Change into the project directory:
cd youtube-downloader
- Run the following command to initialize a new Node.js project:
npm init -y
- Change into the project directory:
-
Install required dependencies:
- Run the following command to install the required packages (
ytdl-core
andfs
):npm install ytdl-core fs
- Run the following command to install the required packages (
-
Create a new JavaScript file:
- Create a new file called
script.js
in the project directory.
- Create a new file called
-
Copy the code into the
script.js
file:- Copy the JavaScript code provided earlier into the
script.js
file.
- Copy the JavaScript code provided earlier into the
-
Run the program:
- Save the file.
- Open your terminal or command prompt.
- Make sure you're in the project directory.
- Run the following command to execute the program:
node script.js
-
Follow the prompts:
- Enter the YouTube video URL when prompted.
- Enter the desired filename (without extension) for the downloaded video.
-
Wait for the download to complete:
- The program will download the YouTube video in the specified quality.
- Once the download is finished, it will display a success message.
Congratulations! You have successfully used the YouTube Video Downloader program. The downloaded video will be saved in the same directory with the specified filename and the ".mp4" extension.
Note: Make sure you have the necessary permissions to write files in the selected directory.
Feel free to let me know what you think about my work !