magneum / youtube-exec

🔥🎶YouTube-Exec: Unleash the Power of YouTube Downloads!
https://bit.ly/magneum
MIT License
20 stars 2 forks source link

no examples #5

Open bek-shoyatbek opened 1 year ago

bek-shoyatbek commented 1 year ago

I want to use it but I couldn't find any examples... It would be great if you add it...

bruno918 commented 11 months ago

const { dlAudioVideo } = require("youtube-exec");

  // Using Promises
  dlAudioVideo({
    url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    folder: "./assets/temp", // optional, default: "youtube-exec"
    filename: "filename", // optional, default: video title
    resolution: 144, // 144, 240, 360, 480, 720, 1080, 1440, 2160, or 4320; default: 480
  })
    .then(() => {
      audioPath =("./assets/temp/filename.mp4");
      console.log("Video downloaded successfully! 🎥🔊🎉");
      // if (fs.existsSync("./assets/temp/filename.mp4")) {
      //   fs.unlinkSync("./assets/temp/filename.mp4");
      // }
    })
    .catch((err) => {
      console.error("An error occurred:", err.message);
    });