Code Monkey home page Code Monkey logo

node-ytdl-core's Introduction

@distube/ytdl-core

DisTube fork of ytdl-core. This fork is dedicated to fix bugs and add features that are not merged to the original repo as soon as possible.

Installation

npm install @distube/ytdl-core@latest

Or for Yarn users:

yarn add @distube/ytdl-core@latest

Make sure you're installing the latest version of @distube/ytdl-core to keep up with the latest fixes.

Usage

All the usage is the same as the original repo, except for the installation part.

const fs = require("fs");
const ytdl = require("@distube/ytdl-core");
// TypeScript: import ytdl from '@distube/ytdl-core'; with --esModuleInterop
// TypeScript: import * as ytdl from '@distube/ytdl-core'; with --allowSyntheticDefaultImports
// TypeScript: import ytdl = require('@distube/ytdl-core'); with neither of the above

ytdl("http://www.youtube.com/watch?v=aqz-KE-bpKQ").pipe(fs.createWriteStream("video.mp4"));

API

You can find the API documentation in the original repo

Limitations

ytdl cannot download videos that fall into the following

  • Regionally restricted (requires a proxy)
  • Private (if you have access, requires cookies)
  • Rentals (if you have access, requires cookies)
  • YouTube Premium content (if you have access, requires cookies)
  • Only HLS Livestreams are currently supported. Other formats will get filtered out in ytdl.chooseFormats

Generated download links are valid for 6 hours, and may only be downloadable from the same IP address.

Ratelimits

When doing to many requests YouTube might block. This will result in your requests getting denied with HTTP-StatusCode 429. The following Steps might help you:

  • Update @distube/ytdl-core to the latest version
  • Use proxies (you can find an example here)
  • Extend on the Proxy Idea by rotating (IPv6-)Addresses
    • read this for more information about this
  • Use cookies (you can find an example here)
    • for this to take effect you have to FIRST wait for the current ratelimit to expire
  • Wait it out (it usually goes away within a few days)

Update Checks

The issue of using an outdated version of ytdl-core became so prevalent, that ytdl-core now checks for updates at run time, and every 12 hours. If it finds an update, it will print a warning to the console advising you to update. Due to the nature of this library, it is important to always use the latest version as YouTube continues to update.

If you'd like to disable this update check, you can do so by providing the YTDL_NO_UPDATE env variable.

env YTDL_NO_UPDATE=1 node myapp.js

Related Projects

  • DisTube - A Discord.js module to simplify your music commands and play songs with audio filters on Discord without any API key.
  • @distube/ytsr - DisTube fork of ytsr.
  • @distube/ytpl - DisTube fork of ytpl.

node-ytdl-core's People

Contributors

fent avatar skick1234 avatar timeforaninja avatar greenkeeper[bot] avatar firecontroller1847 avatar aasim-a avatar raltamirano avatar hcgrandon avatar waqasibrahim avatar dependabot-preview[bot] avatar gatecrasher777 avatar depfu[bot] avatar tinyman avatar roki100 avatar andrewrk avatar vladdrozd avatar coderaiser avatar rafer45 avatar thepieterdc avatar moisout avatar mattez02 avatar favna avatar guichaguri avatar yinglunq avatar brunomoreira99 avatar rubs019 avatar sank6 avatar shanethmoore avatar sesam avatar skybldev 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.