Coder Social home page Coder Social logo

insanity54 / youtube-dl-installer-ng Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kikobeats/youtube-dl-installer

0.0 1.0 0.0 17 KB

Platform independent binary installer of youtube-dl

License: MIT License

JavaScript 46.13% TypeScript 53.87%

youtube-dl-installer-ng's Introduction

youtube-dl-installer-ng

Last version Build Status Dependency status Dev Dependencies Status NPM Status GitHub issues

Platform independent binary installer of youtube-dl.

Fork of Kikobeats/youtube-dl-installer which has gone unmaintained for some time.

Install

$ npm install youtube-dl-installer-ng --save

Usage

Require this module in your js application. Doing so will ensure that the latest version of youtube-dl is installed on your system. @todo add where it gets installed

require('youtube-dl-installer')

Following that, you can directly invoke the youtube-dl binary using child_process, or indirectly using a module such as youtube-dl or ytdl-run.

child_process example

'use strict'

require('youtube-dl-installer')
const { promisify } = require('util')
const execFile = promisify(require('child_process').execFile)

const getInfo = async url => {
  const args = [ '--dump-json', '-f', 'best', url ]
  const {stdout, stderr} = await execFile(youtubeDlPath, args)
  return stderr === '' ? JSON.parse(stdout) : {}
}

;(async () => {
  const payload = await getInfo('https://www.youtube.com/watch?v=hwMkbaS_M_c')
  console.log(payload)
})()

ytdl-run example

'use strict'

require('youtube-dl-installer');
var ytdl2 = require('ytdl-run');

const opts = [
  '-f', 'bestaudio', 'https://www.youtube.com/watch?v=IgbO5pilG5I'
];

ytdl.stream(opts)
  .stdout
  .pipe(fs.createWriteStream('video.mp4'))

youtube-dl-installer-ng's People

Contributors

insanity54 avatar kikobeats avatar greenkeeper[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.