Socket
Socket
Sign inDemoInstall

yt-converter

Package Overview
Dependencies
33
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yt-converter

A youtube video converter for mp3 and mp4 using node-ytdl and ffmpeg


Version published
Weekly downloads
171
increased by2037.5%
Maintainers
1
Install size
86.0 MB
Created
Weekly downloads
 

Readme

Source

Node YoutubeDL - Easy to use downloader for YouTube videos

[!IMPORTANT] Version 2.0 Released. New way to use it.

Installation

npm install yt-converter

Usage

There's two ways to use this library, convert audio or video. For this the package exports two functions named Audio, and Video, each one is for convert audio and video respectively.

Converting Youtube Video to MP3 file

import { Video, Audio } from '../dist/src/index';

const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1';

async function test(url:string) {
  const data = await Audio({
    url,
    onDownloading: (d) => console.log(d),
  });

  console.log(data.message);
}

test(link);

Converting Youtube Video to MP4 file

import { Video, Audio } from '../dist/src/index';

const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1';

async function test(url:string) {
  const data = await Video({
    url,
    onDownloading: (d) => console.log(d),
  });

  console.log(data.message);
}

test(link);

Function params

Both fuctions need an options object.

  • url: Expect to be a string representing the url link of the youtube video.
  • directory (optional): Path relative where you want the file converted.
  • itag: This represents a number of a specific format. For more information
  • onDownloading (optional) : Function will be executed while the file is downloading.

Once the functions Video and Audio are executed, returns a promise wich resolve a data object.

  • message
  • error
  • videoInfo

Keywords

FAQs

Last updated on 03 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc