Giter Club home page Giter Club logo

node-youtube-ext's Introduction

YouTube Extractor

A simple YouTube scraper.

Documentation

⚠️ YouTube stream data is decoded by evaluating arbitrary JavaScript code. By default, youtube-ext uses eval or node:vm. Please install isolated-vm or @ohmyvm/vm to prevent security issues.

Features

  • Faster and Better! (comparison)
  • Supports YouTube stream generation.
  • Supports YouTube search.
  • Supports YouTube video information.
  • Supports YouTube playlist information.
  • Supports YouTube channel information.
  • No key required!

Installation

npm install youtube-ext

Usage

const ytext = require("youtube-ext");
// or
import ytext from "youtube-ext";
// or
import { ... } from "youtube-ext";

Examples can be found here!

Links

Similar Packages

License

MIT

node-youtube-ext's People

Contributors

twlite avatar zyrouge avatar zywouge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-youtube-ext's Issues

Could not extract stream for this track: TypeError: value.matchAll is not a function or its return value is not iterable

So i just updated to the newest version of youtube-ext and it showed me this error, any idea why that could happen?

Could not extract stream for this track

TypeError: value.matchAll is not a function or its return value is not iterable
    at parseYoutubeKeywords (C:\Users\XXX\XXX\TestBot2\node_modules\youtube-ext\dist\utils\youtube.js:31:27)
    at C:\Users\XXX\XXX\TestBot2\node_modules\youtube-ext\dist\videoInfo.js:139:52
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\XXX\XXX\TestBot2\node_modules\youtube-ext\dist\videoInfo.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I am using it in combination with discord-player.
youtube-ext: "1.1.15"

Solution for not getting videos data:

You are filtering for "HOME" but you should filter for smt where the content is, because the language changes...
?.find((x) => (x?.tabRenderer?.content))

ERR_NO_RESULT: Could not extract stream for this track

I'm using NodeJS 20.7.0

"@discord-player/equalizer": "^0.2.2",
"@discord-player/extractor": "^4.3.1",
"@discord-player/utils": "^0.2.1",
"@discordjs/voice": "^0.16.0",
"discord-player": "^6.6.3",
"discord-player-deezer": "^0.0.8",
"mediaplex": "^0.0.6",
"youtube-ext": "^1.1.12"
[30/09/2023 10:45:24 ERR]: ERR_NO_RESULT: Could not extract stream for this track                       
Error: Expected "formats" to be "object" but received "undefined".                                       
at /root/ihrz-prod/node_modules/youtube-ext/dist/getFormats.js:27:15                                  
at Generator.next (<anonymous>)                                                                       
at /root/ihrz-prod/node_modules/youtube-ext/dist/getFormats.js:8:71                                   
at new Promise (<anonymous>)                                                                          
at __awaiter (/root/ihrz-prod/node_modules/youtube-ext/dist/getFormats.js:4:12)           at Object.getFormats (/root/ihrz-prod/node_modules/youtube-ext/dist/getFormats.js:24:46)
at _YoutubeExtractor._stream (/root/ihrz-prod/node_modules/@discord-player/extractor/dist/index.js:1  
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)                         
at async /root/ihrz-prod/node_modules/discord-player/dist/index.js:2502:12                            

Example: https://youtu.be/KMcf2-Ld1yg

Cordialy,
Anaïs

Failed to parse contents from data. (SyntaxError: Unexpected token } in JSON at position 8653)

Full error message:
Error: Failed to parse contents from data. (SyntaxError: Unexpected token } in JSON at position 8653)
at /home/buffolollo/DrummerTS/node_modules/youtube-ext/dist/search.js:56:15
at Generator.next ()
at fulfilled (/home/buffolollo/DrummerTS/node_modules/youtube-ext/dist/search.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Age restricted youtube url play issue

Hi,

I'm getting the following error on a debug when attempting to get my discord bot to play music from a youtube playlist / song that Youtube has placed a sign in required / age restricted content on.

I've added my session cookie to the header options for the player:

const YOUTUBE_COOKIE = process.env.cookie

client.player = new Player(client, {
ytdloptions: {
quality: 'highestaudio',
highWaterMark: 1 << 25,
requestOptions: {
headers: {
cookie: YOUTUBE_COOKIE,
}
}
}
});

Please see my previous case with discord-player on their take on the issue: Androz2091/discord-player#1793

URL attempting to play: https://www.youtube.com/watch?v=7EqnoEljHCw (F You by Dr. Dre)

versions:
Node Version: 18.17.0
Discord Player Version: 6.6.2
Discord.js Version: 14.12.0

just looking for the right code / information to either be able to get the app to sign into youtube or accept the cookie / play age restricted content.

Many thanks

Playlist scraping seems broken

The playlist sample returns

error: Failed to parse data from webpage. (TypeError: Cannot read properties of undefined (reading 'split')) at /Users/tobiasanhalt/Development/nations-unite-cli/node_modules/youtube-ext/dist/playlistInfo.js:51:15 at Generator.next (<anonymous>) at fulfilled (/Users/tobiasanhalt/Development/nations-unite-cli/node_modules/youtube-ext/dist/playlistInfo.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:95:5)
printFatalErrorUponExit                               	source-map-support.js:726
process.emit.sharedData.processEmitHook.installedValue	source-map-support.js:753
exit                                                  	per_thread:192
process.emit.sharedData.processEmitHook.installedValue	source-map-support.js:750
(anonymous function)                                  	execution:149
processPromiseRejections                              	promises:288
processTicksAndRejections                             	task_queues:96

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.