1.4.0 • Published 26 days ago

youtubei v1.4.0

Weekly downloads
235
License
MIT
Repository
github
Last release
26 days ago

Youtubei

Youtubei is made to replace my other library scrape-yt. Instead of scrapping data from Youtube page, youtubei fetches data by sending a request directly to https://www.youtube.com/youtubei/v1, which should be faster and provide more reliable result.

Requires Node >= 16

Documentation

Installation

npm i youtubei

or use the dev build directly from GitHub:

npm i git://github.com/suspiciouslookingowl/youtubei.git#dist

Example

const { Client, MusicClient } = require("youtubei");
// or for TS / ES6
import { Client, MusicClient } from "youtubei";

const youtube = new Client();
const music = new MusicClient();

const run = async () => {
	const videos = await youtube.search("Never gonna give you up", {
		type: "video", // video | playlist | channel | all
	});

	console.log(videos.items.length); // 20
	const nextVideos = await videos.next(); // load next page
	console.log(nextVideos.length); // 18-20, inconsistent next videos count from youtube
	console.log(videos.items.length); // 38 - 40

	// you can also pass the video URL
	const video = await youtube.getVideo("dQw4w9WgXcQ");

	const channelVideos = await video.channel.videos.next();
	const channelPlaylists = await video.channel.playlists.next();

	// you can also pass the playlist URL
	const playlist = await youtube.getPlaylist("UUHnyfMqiRRG1u-2MsSQLbXA");
	console.log(playlist.videos.items.length); // first 100 videos;
	let newVideos = await playlist.videos.next(); // load next 100 videos
	console.log(playlist.videos.items.length); // 200 videos;
	await playlist.videos.next(0); // load the rest videos in the playlist

	// search using music client
	const shelves = await music.search("Never gonna give you up");
	console.log(shelves);
};

run();
1.4.0

26 days ago

1.3.7

1 month ago

1.3.6

1 month ago

1.3.5

1 month ago

1.3.4

3 months ago

1.3.3

4 months ago

1.3.2

4 months ago

1.3.1

4 months ago

1.3.0

4 months ago

1.2.0

6 months ago

1.2.1

6 months ago

1.0.0

1 year ago

1.0.0-rc.9

1 year ago

1.0.0-rc.7

1 year ago

1.0.0-rc.8

1 year ago

1.0.0-rc.6

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.2

1 year ago

1.0.0-rc.5

2 years ago

1.0.0-rc.3

2 years ago

1.0.0-rc.4

2 years ago

0.0.1-rc.36

2 years ago

1.0.0-rc.1

2 years ago

1.0.0-rc.2

2 years ago

0.0.1-rc.31

2 years ago

0.0.1-rc.30

2 years ago

0.0.1-rc.33

2 years ago

0.0.1-rc.32

2 years ago

0.0.1-rc.35

2 years ago

0.0.1-rc.34

2 years ago

0.0.1-rc.29

2 years ago

0.0.1-rc.28

2 years ago

0.0.1-rc.26

3 years ago

0.0.1-rc.27

3 years ago

0.0.1-rc.25

3 years ago

0.0.1-rc.24

3 years ago

0.0.1-rc.23

3 years ago

0.0.1-rc.22

3 years ago

0.0.1-rc.21

3 years ago

0.0.1-rc.20

3 years ago

0.0.1-rc.19

3 years ago

0.0.1-rc.17

3 years ago

0.0.1-rc.16

3 years ago

0.0.1-rc.18

3 years ago

0.0.1-rc.15

3 years ago

0.0.1-rc.14

3 years ago

0.0.1-rc.13

3 years ago

0.0.1-rc.12

3 years ago

0.0.1-rc.11

3 years ago

0.0.1-rc.10

3 years ago

0.0.1-rc.7

3 years ago

0.0.1-rc.8

3 years ago

0.0.1-rc.5

3 years ago

0.0.1-rc.6

3 years ago

0.0.1-rc.9

3 years ago

0.0.1-rc.3

3 years ago

0.0.1-rc.4

3 years ago

0.0.1-rc.2

3 years ago

0.0.1-rc.1

3 years ago

0.0.1-rc.0

3 years ago