6.0.8 • Published 7 months ago

@ybd-project/ytdl-core v6.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@ybd-project/ytdl-core - v6

npm version jsDelivr License: MIT

YBD Project fork of ytdl-core. This fork is dedicated to developing a YouTube downloader that is fast, stable, and takes into account various use cases, with reference to LuanRT/YouTube.js and yt-dlp.

!NOTE If you are looking for v5 documentation for @ybd-project/ytdl-core, please click here.

Table of Contents

ℹ️Announcements at this timeℹ️

!CAUTION Currently, the account that manages this ytdl-core repository has been flagged as spam, so we are accepting issues, etc. at ybd-project-ver1/ytdl-core instead. Thank you for your cooperation.

Prerequisite

To use @ybd-project/ytdl-core without problems, use Node.js 16 or higher. (Recommended is Node.js 18 or higher.)

!IMPORTANT Use with Node.js 16 is not recommended, but will be supported as much as possible.

Operating Environment

!IMPORTANT @ybd-project/ytdl-core has not been tested in non-Node.js environments such as Deno. If you need ytdl-core optimized for these environments, please create an issue.

Default (Node.js)

As usual, when using Node.js, as noted in the prerequisites, v16 or higher will work fine. If you have an example that does not work with 16 or higher versions, please create an issue.

Browser

When using a browser, the latest version is preferred due to the API used. However, when operating a website or other site, it is unknown which version and browser the client will use, so the following are the main browsers (Chrome, Edge, Firefox, Brave, Opera, Safari) that are currently confirmed to work.

List

Live demo used for testing: ytdlcore.static.jp

Browser NameSupported Versions
Google Chromev76 - latest
Microsoft Edgev80 - latest
Mozilla FireFoxv78 - latest
Apple Safariv14 - latest
Bravev1 - latest
Operav63 - latest

(Tested with BrowserStack)

Serverless

We have confirmed that ytdl-core for serverless functions works properly in the following environment.

!TIP We recommend deploying to Cloudflare Workers because of its simplicity and lower cost compared to other platforms.

Service NameRemarks
Cloudflare WorkersWith nodejs_compat compatibility flag
Vercel FunctionsStreaming doesn't work.

Installation

npm install @ybd-project/ytdl-core@latest

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

API Documentation

For details API documentation, see the Wiki.

Basic Usage

Only a simple example is given in the README. For a list of options and other advanced usage, please refer to the API Documentation.

import fs from 'fs';
import { YtdlCore, toPipeableStream } from '@ybd-project/ytdl-core';
// For browser: import { YtdlCore } from '@ybd-project/ytdl-core/browser';
// For serverless functions: import { YtdlCore } from '@ybd-project/ytdl-core/serverless';

// JavaScript: const { YtdlCore } = require('@ybd-project/ytdl-core');

const ytdl = new YtdlCore({
    // The options specified here will be the default values when functions such as getFullInfo are executed.
});

// Download a video
ytdl.download('https://www.youtube.com/watch?v=dQw4w9WgXcQ').then((stream) => toPipeableStream(stream).pipe(fs.createWriteStream('video.mp4')));

// Get video info
ytdl.getBasicInfo('https://www.youtube.com/watch?v=dQw4w9WgXcQ').then((info) => {
    console.log(info.videoDetails.title);
});

Examples

See the Examples folder for examples of using @ybd-project/ytdl-core.

Precautions

Limitations

@ybd-project/ytdl-core is unable to retrieve or download information from the following videos.

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

The URL to view the retrieved video is valid for 6 hours. (In some cases, downloading may only be possible from the same IP.)

Rate Limiting

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

  • Update @ybd-project/ytdl-core to the latest version
  • Use OAuth2 (you can find an example here)
  • Use proxies (you can find an example here)
  • Extend the Proxy Idea by rotating (IPv6-)Addresses
    • read this for more information about this
  • Wait it out (it usually goes away within a few days)

License

Distributed under the MIT License.

6.0.9-beta.12

7 months ago

6.0.9-beta.7

7 months ago

6.0.9-beta.8

7 months ago

6.0.9-beta.9

7 months ago

6.0.9-beta.6

7 months ago

6.0.9-beta.4

7 months ago

6.0.9-beta.5

7 months ago

6.0.9-beta.3

7 months ago

6.0.7

8 months ago

6.0.8

8 months ago

6.0.9-beta.2

8 months ago

6.0.9-beta.1

8 months ago

6.0.6

8 months ago

6.0.6-2

8 months ago

6.0.6-beta.6

8 months ago

6.0.6-beta.5

8 months ago

6.0.6-beta.2

8 months ago

6.0.6-beta.1

8 months ago

6.0.6-beta.4

8 months ago

6.0.6-beta.3

8 months ago

6.0.5

9 months ago

6.0.5-beta.12

9 months ago

6.0.5-beta.6

9 months ago

6.0.5-beta.11

9 months ago

6.0.5-beta.7

9 months ago

6.0.5-beta.4

9 months ago

6.0.5-beta.5

9 months ago

6.0.5-beta.8

9 months ago

6.0.5-beta.9

9 months ago

6.0.5-beta.10

9 months ago

6.0.5-beta.2

9 months ago

6.0.5-beta.3

9 months ago

6.0.5-beta.1

9 months ago

6.0.4

9 months ago

6.0.0-beta.7

10 months ago

6.0.0-beta.8

10 months ago

6.0.0-beta.9

10 months ago

6.0.0-beta.4

10 months ago

6.0.0-beta.5

10 months ago

6.0.0-beta.6

10 months ago

6.0.0-beta.1

10 months ago

6.0.0-beta.2

10 months ago

6.0.2-beta.3

9 months ago

6.0.2-beta.4

9 months ago

6.0.2-beta.2

9 months ago

6.0.0-beta.13

10 months ago

6.0.0-beta.12

10 months ago

6.0.0-beta.11

10 months ago

6.0.0-beta.10

10 months ago

6.0.1

9 months ago

6.0.0

9 months ago

6.0.3

9 months ago

6.0.2

9 months ago

6.0.0-2

9 months ago

5.1.5

10 months ago

5.1.4

10 months ago

5.1.3

10 months ago

5.1.2

10 months ago

5.1.1

10 months ago

5.1.0

10 months ago

5.0.20

10 months ago

5.1.4-2

10 months ago

5.0.13

10 months ago

5.0.14

10 months ago

5.0.15

10 months ago

5.0.16

10 months ago

5.0.17

10 months ago

5.0.18

10 months ago

5.0.19

10 months ago

5.1.9-2

10 months ago

5.1.5-2

10 months ago

5.1.9

10 months ago

5.1.8

10 months ago

5.1.7

10 months ago

5.1.6

10 months ago

5.0.6

11 months ago

5.0.5

11 months ago

5.0.4

11 months ago

5.0.3

11 months ago

5.0.5-test.2

11 months ago

5.0.2

11 months ago

5.0.5-test.1

11 months ago

5.0.1

11 months ago

5.0.10

11 months ago

5.0.5-test.4

11 months ago

5.0.0

11 months ago

5.0.11

11 months ago

5.0.12

11 months ago

5.0.5-test.6

11 months ago

5.0.5-test.5

11 months ago

5.0.0-test.6

11 months ago

5.0.0-test.4

11 months ago

5.0.1-test.3

11 months ago

5.0.0-test.3

11 months ago

5.0.1-test.4

11 months ago

5.0.0-test.2

11 months ago

5.0.0-test.1

11 months ago

5.0.1-test.2

11 months ago

5.0.9-2

11 months ago

5.0.9

11 months ago

5.0.8

11 months ago

5.0.7

11 months ago

4.15.0

11 months ago

4.14.6

11 months ago

4.14.5

11 months ago

4.14.4

11 months ago