Files
YouTube.js/README_v2.0.0WIP.md
LuanRT bd7279f800 docs: remove uneeded badge
This is kind of ugly so let's get rid of it.
2022-07-07 15:43:08 -03:00

9.0 KiB

YouTube.js

A full-featured wrapper around the Innertube API, which is what YouTube itself uses.

Report Bug · Request Feature

Tests Latest version Codefactor Monthly downloads Say thanks


WIP- Documentation for YouTube.js 2.0.0

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Disclaimer

About

Innertube is an API used across all YouTube clients, it was created to simplify1 the internal structure of the platform in a way that updates, tweaks, and experiments can be easily made. This library handles all the low-level communication with Innertube, providing a simple, fast, and efficient way to interact with YouTube programmatically.

And huge thanks to @gatecrasher777 for his research on the workings of the Innertube API!

Getting Started

Prerequisites

To verify things are set up properly, run this:

node --version

Installation

  • NPM:
npm install youtubei.js@latest
  • Yarn:
yarn add youtubei.js@latest
  • Git (bleeding-edge version):
npm install git+https://github.com/LuanRT/YouTube.js.git

Usage

Create an Innertube instance (or session):

// const Innertube = require('youtubei.js');
import Innertube from 'youtubei.js';
const youtube = await new Innertube({ gl: 'US' });

API

Innertube : object

getInfo(video_id)

Retrieves video info, including playback data and even layout elements such as menus, buttons etc — all nicely parsed.

Returns: Promise.<VideoInfo>

Param Type Description
video_id string The id of the video

Methods & Getters:

getBasicInfo(video_id)

Suitable for cases where you only need basic video metadata, much faster than getInfo().

Returns: Promise.<VideoInfo>

Param Type Description
video_id string The id of the video

search(query, filters?)

Searches the given query on YouTube.

Returns: Promise.<Search>

Param Type Description
query string The search query
filters object Search filters

Supported search filters:

  • type: all | video | channel | playlist | movie
  • upload_date: all | hour | today | week | month | year
  • duration: all | short | medium | long
  • sort_by: relevance | rating | upload_date | view_count

Methods & Getters:

getHomeFeed()

Retrieves YouTube's home feed.

Returns: Promise.<FilterableFeed>

Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

Contributors

Contact

LuanRT - @lrt_nooneknows - luan.lrt4@gmail.com

Project Link: https://github.com/LuanRT/YouTube.js

Disclaimer

This project is not affiliated with, endorsed, or sponsored by YouTube or any of their affiliates or subsidiaries. All trademarks, logos and brand names are the property of their respective owners, and are used only to directly describe the services being provided, as such, any usage of trademarks to refer to such services is considered nominative use.

Should you have any questions or concerns please contact me directly via email.

License

Distributed under the MIT License.

(back to top)