All Projects → DrKain → Scrape Youtube

DrKain / Scrape Youtube

Licence: mit
A lightning fast package to scrape YouTube search results. This was made and optimized for Discord Bots.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Scrape Youtube

Distube
A Discord.js v12 module to simplify your music commands and play songs with audio filters on Discord without any API key. Support YouTube, SoundCloud, Bandcamp, Facebook, and 700+ more sites
Stars: ✭ 73 (+69.77%)
Mutual labels:  bot, search, discord, youtube
Discord Player
🎧 Complete framework to simplify the implementation of music commands using discords.js v12
Stars: ✭ 161 (+274.42%)
Mutual labels:  bot, search, discord, youtube
Discord.js Musicbot Addon
This DOES NOT WORK any more. This repo only serves as an archive for is anyone wants to pickup my work. You may still join the discord however.
Stars: ✭ 109 (+153.49%)
Mutual labels:  bot, discord, npm, youtube
Clinet
Official repository for Clinet, a Discord bot intended for assistance and control within your guilds.
Stars: ✭ 28 (-34.88%)
Mutual labels:  bot, discord, youtube
Mirai
The core for Mirai Bot v4 [Deprecated]
Stars: ✭ 142 (+230.23%)
Mutual labels:  bot, discord, npm
Pixie
An open-source Discord bot built for weebs, by a weeb.
Stars: ✭ 20 (-53.49%)
Mutual labels:  bot, discord
Pvpcraft
PvPCraft Discord bot
Stars: ✭ 29 (-32.56%)
Mutual labels:  bot, discord
Discord Bot
🤖 Our BIG help in things about moderation and many more useful stuff on our Discord server.
Stars: ✭ 30 (-30.23%)
Mutual labels:  bot, discord
Modmail
A feature rich discord Modmail bot
Stars: ✭ 957 (+2125.58%)
Mutual labels:  bot, discord
Drawbot
Repository for DrawBot. The Discord Art bot!
Stars: ✭ 10 (-76.74%)
Mutual labels:  bot, discord
Dogey
🐶 - My general purpose bot for Discord
Stars: ✭ 30 (-30.23%)
Mutual labels:  bot, discord
Torrenter
Simple nodejs package to download torrents using torrent-indexer and webtorrent, especially movie and series.
Stars: ✭ 42 (-2.33%)
Mutual labels:  search, movie
Eris
A NodeJS Discord library
Stars: ✭ 879 (+1944.19%)
Mutual labels:  bot, discord
Deku
Multi-purpose discord bot built with discord.js
Stars: ✭ 13 (-69.77%)
Mutual labels:  bot, discord
Automuteus
Discord Bot to automute Among Us players at round transitions, in conjunction with https://github.com/denverquane/amonguscapture
Stars: ✭ 852 (+1881.4%)
Mutual labels:  bot, discord
Kuro
An easy to use self bot with different utilities written in NodeJS
Stars: ✭ 31 (-27.91%)
Mutual labels:  bot, discord
Clara
A general purpose Node.JS bot for Discord.
Stars: ✭ 37 (-13.95%)
Mutual labels:  bot, discord
Throw Voice
Simple audio recording for Discord. Mirror of https://gitlab.com/pawabot/pawa
Stars: ✭ 36 (-16.28%)
Mutual labels:  bot, discord
Calebj Cogs
⚙ Cogs for Red-Discordbot
Stars: ✭ 42 (-2.33%)
Mutual labels:  bot, discord
Moviemagnetbot
🤖 telegram bot for movies
Stars: ✭ 39 (-9.3%)
Mutual labels:  bot, movie

Scrape YouTube

NPM NPM NPM

What is this?

A lightning fast package to scrape YouTube search results. This was made and optimized for Discord Bots.
This package is updated often to fix minor problems or parsing issues. Please ensure you have the latest version before making an issue on GitHub.

Install

npm install scrape-youtube

Require

import youtube from 'scrape-youtube';
// const youtube = require('scrape-youtube').default;

Search

youtube.search('Short Change Hero').then(results => {
    // Unless you specify a type, it will only return 'video' results
    console.log(results.videos); 
});

Custom Types

Supported types are: video, live, movie, any and playlist

youtube.search('lofi hip hop beats to relax/study to', { type: 'live' }).then(results => {
  console.log(results.streams);
})

Example Response (Video)

This is the structure of a single video result. The search function will return up to 20 results per search.

{
  "id": "lkvScx3Po8I",
  "title": "The Heavy - Short Change Hero",
  "link": "https://www.youtube.com/watch?v=lkvScx3Po8I",
  "description": "... long description ...",   
  "thumbnail": "https://i.ytimg.com/vi/lkvScx3Po8I/hqdefault.jpg",
  "channel": {
    "name": "Magloire Lamine",
    "link": "https://youtube.com/user/TENESANGO",
    "verified": false,
    "thumbnail": "https://yt3.ggpht.com/a/AATXAJz3kOe_LDvhRWpQLu1wHb5xU7HNOKvpKQnLQA=s88-c-k-c0xffffffff-no-rj-mo"
  },  
  "views": 7960221,
  "duration": 238,
  "uploaded": "6 years ago"
}

Example Response (Live Stream)

This is the structure of a single live stream result.

{
  "id": "5qap5aO4i9A",
  "title": "lofi hip hop radio - beats to relax/study to",
  "link": "https://youtu.be/5qap5aO4i9A",
  "thumbnail": "https://i.ytimg.com/vi/5qap5aO4i9A/hqdefault.jpg",
  "channel": {
    "name": "ChilledCow",
    "link": "https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow",
    "verified": false,
    "thumbnail": "https://yt3.ggpht.com/a-/AOh14Gj1ME7zG6pJG6689WU13fYHmafnUGK7IMeWIg=s68-c-k-c0x00ffffff-no-rj-mo"
  },
  "watching": 34576
}

Example Response (Playlist)

This is the structure of a single playlist result. Please note that the "videos" will only contain 1-2 items. This is what is available from the search results. If you wish to load an entire playlist, consider using ytdl-core.

{
  "id": "PLEPHBRITc9qNl4G4IaZPGsx0nueg6d_6N",
  "title": "Johann Sebastian Bach Adagios for relaxation",
  "link": "https://www.youtube.com/playlist?list=PLEPHBRITc9qNl4G4IaZPGsx0nueg6d_6N",
  "thumbnail": "https://i.ytimg.com/vi/yoaNCEE4QLY/hqdefault.jpg",
  "channel": {
    "name": "Fredericia's Channel",
    "link": "https://www.youtube.com/channel/UCUDT_zh1GA8qfisSZXemt6Q",
    "verified": false,
    "thumbnail": "https://www.gstatic.com/youtube/img/originals/promo/ytr-logo-for-search_160x160.png"
  },
  "videoCount": 15,
  "videos": [
    {
      "id": "yoaNCEE4QLY",
      "title": "J S Bach Jesu Joy of Man's Desiring chamber orchestra version",
      "link": "https://youtu.be/yoaNCEE4QLY",
      "duration": 211,
      "thumbnail": "https://i.ytimg.com/vi/yoaNCEE4QLY/hqdefault.jpg"
    },
    {
      "id": "mGV_oiAcmaY",
      "title": "Bach Violin Concerto in D Minor",
      "link": "https://youtu.be/mGV_oiAcmaY",
      "duration": 381,
      "thumbnail": "https://i.ytimg.com/vi/mGV_oiAcmaY/hqdefault.jpg"
    }
  ]
}

Custom Filters

You can pass { sp: 'ABC' } as the second parameter to use custom filters like upload date, duration, features ect.
You will need to fetch the SP parameter yourself from youtube. Please see this image for an example.

Custom Request Options

You can pass { requestOptions: { } } as the second parameter to use custom headers, agents ect.
See http.request for more information. Example:

youtube.search('Poets of the fall', {
    requestOptions: {
        headers: { 'Accept-Language': 'de' }
    }
})

Debugging

In some cases advanced debugging might be required for fixing issues on GitHub.
When enabled each search will create 3 files, please compress/zip and include with your issue.
It's not recommended to use this unless requested specifically.

youtube.debug = true; // Enable regular debugging
youtube.debugger.enabled = true; // Enable debug dumps
youtube.debugger.setDirectory('path/to/somewhere'); // Directory to write the dumps  

Notes

  • Multiple pages can not be loaded. YouTube changed how loading works so this is currently not available.
  • If this package stops working please create an issue on GitHub so I can fix it as soon as possible.
  • If this readme is lacking, Please feel free to create a PR fixing or adding any information you feel would help. I gladly accept any helpful pull requests or contributions.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].