npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ytubes

v1.3.1

Published

Search for videos, shorts, playlists, channels, movies, live and musics on youtube without api key.

Downloads

67

Readme

ytubes

npm license

Search for videos, shorts, playlists, channels, movies, live and musics on youtube without api key.

Install

yarn add ytubes

Usage

import ytubes from 'ytubes'

const videos = await ytubes.getVideo('Amor e fé', { max: 1, language: 'pt-BR' })

Typescript

import * as ytubes from 'ytubes'

Functions

getVideo(query, options)

Returns the details of all videos found

const video = await ytubes.getVideo('Amor e fé')
[
  {
    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'
  },
  ...
]

getShorts(query, options)

Returns the details of all shorts found

const video = await ytubes.getShorts('Beat Tribo da Periferia')
[
  {
    id: 'RV9JhsBN26s',
    type: 'shorts',
    title: 'Beat Insônia Tribo da periferia & Hungria - cover beat #shorts',
    views: 2286,
    link: 'https://www.youtube.com/shorts/RV9JhsBN26s',
    channel: 'https://www.youtube.com/@g-ruahiphop',
    thumbnail: 'https://i.ytimg.com/vi/RV9JhsBN26s/maxresdefault.jpg'
  },
  ...
]

getPlaylist(query, options)

Returns the details of all playlist found

const playlist = await ytubes.getPlaylist('Tribo da Periferia - As Melhores')
[
  {
    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'
      },
      ...
    ]
  },
  ...
]

getChannel(query, options)

Returns the details of all channel found

const channel = await ytubes.getChannel('Hungria Hip Hop')
[
  {
    id: 'UCAI8SmRbXgSpP8Zo3xZbxzQ',
    type: 'channel',
    name: 'OficialHungria',
    verified: true
    link: 'https://www.youtube.com/c/OficialHungria',
  },
  ...
]

getChannelVideos(query, options)

Returns the details of all channel videos

const channel = await ytubes.getChannelVideos('@eminem')
[
  {
    id: 'lexLAjh8fPA',
    type: 'video',
    title: 'Eminem - Like Toy Soldiers (Official Music Video)',
    views: 455969481,
    duration: '5:22',
    uploaded: '13 years ago',
    link: 'https://www.youtube.com/watch?v=lexLAjh8fPA',
    shareLink: 'https://youtu.be/lexLAjh8fPA',
    channel: 'https://www.youtube.com/@eminem',
    thumbnail: 'https://i.ytimg.com/vi/lexLAjh8fPA/maxresdefault.jpg'
  },
  ...
]

getChannelShorts(query, options)

Returns the details of all channel shorts

const channel = await ytubes.getChannelShorts('@eminem')
[
  {
    id: 'By7NMf3C7xk',
    type: 'shorts',
    title: 'Eminem | Fortnite’s The Big Bang Event',
    views: '684K views',
    link: 'https://www.youtube.com/shorts/By7NMf3C7xk',
    channel: 'https://www.youtube.com/@eminem',
    thumbnail: 'https://i.ytimg.com/vi/By7NMf3C7xk/maxresdefault.jpg'
  },
  ...
]

getChannelLives(query, options)

Returns the details of all channel lives

const channel = await ytubes.getChannelLives('@MusicLabChill')
[
  {
    id: '9ZJT08MsRAs',
    type: 'live',
    live: true,
    title: '🎧Music for Maximum Productivity — Chillout Radio 24/7',
    link: 'https://www.youtube.com/watch?v=9ZJT08MsRAs',
    shareLink: 'https://youtu.be/9ZJT08MsRAs',
    channel: 'https://www.youtube.com/@MusicLabChill',
    thumbnail: 'https://i.ytimg.com/vi/9ZJT08MsRAs/maxresdefault.jpg',
    views: 29
  },
  ...
]

getChannelPlaylists(query, options)

Returns the details of all channel playlists

const channel = await ytubes.getChannelPlaylists('@eminem')
[
  {
    id: 'FLfM3zsQsOnfWNUppiycmBuw',
    type: 'playlist',
    title: 'Favorites',
    videoCount: 32,
    link: 'https://www.youtube.com/playlist?list=FLfM3zsQsOnfWNUppiycmBuw',
    channel: 'https://www.youtube.com/@eminem',
    thumbnail: 'https://i.ytimg.com/vi/XbGs_qK2PQA/maxresdefault.jpg',
    preview: 'https://www.youtube.com/watch?v=XbGs_qK2PQA&list=FLfM3zsQsOnfWNUppiycmBuw'
  }
  ...
]

getMovie(query, options)

Returns the details of all movies found

const movie = await ytubes.getMovie('filmes de ação')
[
  {
    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'
  },
  ...
]

getLive(query, options)

Returns the details of all lives found

const live = await ytubes.getLive('Music for Work')
[
  {
    id: '4kLviL8XwAI',
    type: 'live',
    live: true,
    title: 'Music for Work — Programming, Hacking, Coding Radio',
    link: 'https://www.youtube.com/watch?v=4kLviL8XwAI',
    shareLink: 'https://youtu.be/4kLviL8XwAI',
    channel: 'https://www.youtube.com/@MusicLabChill',
    thumbnail: 'https://i.ytimg.com/vi/4kLviL8XwAI/maxresdefault.jpg',
    views: 79
  },
  ...
]

getMusic(query, options)

Returns the details of all musics found

const music = await ytubes.getMusic("2Pac - Pac's Life")
[
  {
    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
  },
  ...
]

search(query, options)

Returns the details of seach

const videos = await ytubes.search('beautiful', { type: 'video' })
[
  {
    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'
  },
  ...
]

Functions options

| 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, shorts, playlist, channel, channelVideos, channelShorts, channelLives, channelPlaylists, movie, live, and music. |

Note

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.

License

MIT

Copyright (c) 2021 Valmisson Grizorte