Search for videos, playlists, channels, movies. live and musics on youtube without api key.
npm install git+https://github.com/OnlineDigital/ytubes.git
# or
yarn add git+https://github.com/OnlineDigital/ytubes.git
import ytubes from 'ytubes/dist/index.js'
const videos = await ytubes.getVideo('Amor e fé', { max: 1, language: 'pt-BR' })
import * as ytubes from 'ytubes/dist/index.js'
Returns the details of all videos found
const video = await ytubes.getVideo('Amor e fé')
Output
[
{
id: 'iZq0u3quAqo',
type: 'video',
title: 'Hungria Hip Hop - Amor e Fé (Official Music Video) #CheiroDoMato',
views: 291003057,
duration: '5:24',
uploaded: '1 year ago',
link: 'https://www.youtube.com/watch?v=iZq0u3quAqo',
shareLink: 'https://youtu.be/iZq0u3quAqo',
channel: 'https://www.youtube.com/channel/UCAI8SmRbXgSpP8Zo3xZbxzQ',
thumbnail: 'https://i.ytimg.com/vi/iZq0u3quAqo/maxresdefault.jpg'
},
...
]
Returns the details of all playlist found
const playlist = await ytubes.getPlaylist('Tribo da Periferia - As Melhores')
Output
[
{
id: 'PL7V1hXWh2rMr4pz6lCkzHMHMLU3-BfQ2S',
type: 'playlist',
title: 'AS MELHORES - TRIBO DA PERIFERIA',
videoCount: 49,
link: 'https://www.youtube.com/playlist?list=PL7V1hXWh2rMr4pz6lCkzHMHMLU3-BfQ2S',
channel: 'https://www.youtube.com/channel/UCe5pPUSFEajlij-LrxUl19A',
thumbnail: 'https://i.ytimg.com/vi/crfRRVISmsw/maxresdefault.jpg',
preview: [
{
id: 'YrQLmElRT-E',
title: 'Tribo da Periferia - Imprevisível (Official Music Video)',
duration: '4:09',
link: 'https://www.youtube.com/watch?v=YrQLmElRT-E',
shareLink: 'https://youtu.be/YrQLmElRT-E',
thumbnail: 'https://i.ytimg.com/vi/YrQLmElRT-E/maxresdefault.jpg'
},
...
]
},
...
]
Returns the details of all channel found
const channel = await ytubes.getChannel('Hungria Hip Hop')
Output
[
{
id: 'UCAI8SmRbXgSpP8Zo3xZbxzQ',
type: 'channel',
name: 'OficialHungria',
verified: true
link: 'https://www.youtube.com/c/OficialHungria',
},
...
]
Returns all the live streams of a specific channel
const lives = await ytubes.getChannelLive('UCSJ4gkVC6NrvII8umztf0Ow')
Output
[
{
id: '5qap5aO4i9A',
type: 'live',
live: true,
title: 'lofi hip hop radio - beats to relax/study to',
link: 'https://www.youtube.com/watch?v=5qap5aO4i9A',
views: 25488,
shareLink: 'https://youtu.be/5qap5aO4i9A',
channel: 'https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow',
thumbnail: 'https://i.ytimg.com/vi/5qap5aO4i9A/maxresdefault.jpg'
},
...
]
Returns all the past live streams of a specific channel
const lives = await ytubes.getChannelPastLive('UCXBE_QQSZueB8082ml5fslg')
Output
[
{
id: 'cilUevUhZfw',
type: 'live',
live: false,
title: 'TIMTHETATMAN RETURNS TO FORTNITE FT NINJA, MARSHMELLO & SYPHERPK',
link: 'https://www.youtube.com/watch?v=cilUevUhZfw',
views: 711695,
shareLink: 'https://youtu.be/cilUevUhZfw',
channel: 'https://www.youtube.com/channel/UCXBE_QQSZueB8082ml5fslg',
thumbnail: 'https://i.ytimg.com/vi/cilUevUhZfw/maxresdefault.jpg'
},
...
]
Returns the details of all movies found
const movie = await ytubes.getMovie('filmes de ação')
Output
[
{
id: 'MuTYo9tofSY',
type: 'video',
title: 'Thor Ragnarok Full Video - Voiced Motion Comic (Marvel Comics)',
views: 7119537,
duration: '1:33:17',
uploaded: '4 years ago',
link: 'https://www.youtube.com/watch?v=MuTYo9tofSY',
shareLink: 'https://youtu.be/MuTYo9tofSY',
channel: 'https://www.youtube.com/user/boscheinen',
thumbnail: 'https://i.ytimg.com/vi/MuTYo9tofSY/maxresdefault.jpg'
},
...
]
Returns the details of all lives found
const live = await ytubes.getLive('Coding in Chicago')
Output
[
{
id: 'esX7SFtEjHg',
type: 'live',
live: true,
title: 'Coding in Chicago | 🎧 LoFi Jazz Hip-Hop [Code - Relax - Study]',
link: 'https://www.youtube.com/watch?v=esX7SFtEjHg',
views: 142,
shareLink: 'https://youtu.be/esX7SFtEjHg',
channel: 'https://www.youtube.com/channel/UC9rvsIHgzuiwTQ-yi0Qj2Mw',
thumbnail: 'https://i.ytimg.com/vi/esX7SFtEjHg/maxresdefault.jpg'
},
...
]
Returns the details of all musics found
const music = await ytubes.getMusic("2Pac - Pac's Life")
Output
[
{
id: 'A1HvFGTB7NE',
type: 'music',
title: "Pac's Life (feat. T.I. & Ashanti)",
artist: '2Pac',
album: "Pac's Life",
duration: '3:37',
link: 'https://music.youtube.com/watch?v=A1HvFGTB7NE',
videoLink: 'https://www.youtube.com/watch?v=A1HvFGTB7NE',
channel: 'https://music.youtube.com/channel/UC5RrGzC-JXglhFW5NhT4r6w',
thumbnail: 'https://i.ytimg.com/vi/A1HvFGTB7NE/maxresdefault.jpg',
explicit: true
},
...
]
Returns the details of seach
const videos = await ytubes.search('beautiful', { type: 'video' })
Output
[
{
id: '_FE194VN6c4',
type: 'video',
title: 'Snoop Dogg - Beautiful (Official Music Video) ft. Pharrell Williams',
views: 160183177,
duration: '5:29',
uploaded: '12 years ago',
link: 'https://www.youtube.com/watch?v=_FE194VN6c4',
shareLink: 'https://youtu.be/_FE194VN6c4',
channel: 'https://www.youtube.com/channel/UC-OO324clObi3H-U0bP77dw',
thumbnail: 'https://i.ytimg.com/vi/_FE194VN6c4/maxresdefault.jpg'
},
...
]
Property | Default | Description |
---|---|---|
max |
30 |
Set the maximum amount of results to return. |
language |
en |
Set the language that you would like for results to be returned in. |
⯆ Option available only in search . |
||
type |
video |
Set the type of search on Youtube. The supported types are video , playlist , channel , movie , live , and music . |
You should keep in mind that this library does not use an official YouTube API and a change may cause an error in the search.
Copyright (c) 2021 Valmisson Grizorte