Socket
Book a DemoInstallSign in
Socket

youtube-s-dl

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtube-s-dl

A YouTube Video/Audio downloader.

latest
Source
npmnpm
Version
1.1.0-beta
Version published
Maintainers
1
Created
Source

YOUTUBE SEARCH & DOWNLOAD

ytvanced

A YouTube Video downloader.

HOW TO INSTALL?

npm i youtube-s-dl

Require to export function

//CommonJS
const {download, search, getStreamFormats, getVideoInfo} = require("youtube-s-dl");

SIMPLE USAGE

search and download videos

const {download, search, getVideoInfo} = require("youtube-s-dl");

let result = await search("Senpai (feat. Hentai Dude)")
console.log(result)
let info = getVideoInfo(result[0].videoId)
console.log(info)
try{
    //download have 2 params. first is videoId required
    //2nd Format object is optional param. 
    format = {
        mimeType: 'video',
        qualityLabel: '480p',
        fps: 30
        //etc.
    }
    stream = await download(result[0].videoId, format)
    path = "./tmp/videoplayback.mp4"
    file = fs.createWriteStream(path)
    stream.pipe(file).on('finish',()=>{
	    console.log("Video Downloaded")
    }).on('close',()=>{
	    console.log("Request Finished")
    }).on('error',()=>{
	    console.log("Seems there's an error happened while writing the file.")
    })
}
catch(e){
    console.log(e)
}

Keywords

youtube-scraper

FAQs

Package last updated on 14 May 2023

Did you know?

Socket

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