fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.52k stars 801 forks source link

This video is unavailable error #394

Closed FraWolf closed 5 years ago

FraWolf commented 5 years ago

Hi everyone! I was trying to add a video by a link but with every link I try it says: "Error: This video is unavailable.". I've the latest version of ytdl-core (0.28.3), and the error is in the let info = await ytdl.videoInfo("url").catch(err => { console.log(err) });

fent commented 5 years ago

Not sure what ytdl.videoinfo() refers to. Is that a custom function?

FraWolf commented 5 years ago

Ops, bad copy-paste, I was talking about let info = await ytdl.getInfo("url").catch(err => { console.log(err) });

fent commented 5 years ago

A few more questions to help narrow down the issue

FraWolf commented 5 years ago
TimeForANinja commented 5 years ago

did you try going back to a older ytdl-core version to see whether that fixes your problem?

FraWolf commented 5 years ago

Yes, but nothing, same error.

TimeForANinja commented 5 years ago

What you can try is writing the body you receive from the request into a .html and open it using your browser / sending us That might already tell you where the problem's at

FraWolf commented 5 years ago

I'm using Glitch.com for use ytdl-core. I'm hosting my own discord bot there.

TimeForANinja commented 5 years ago

I'm using Glitch.com for use ytdl-core. I'm hosting my own discord bot there.

haven't heard from that ¯\(ツ)

TimeForANinja commented 5 years ago

but i guess that's your problem

It is strongly advised you actually shell out a couple dollars a month and get an actual real VPS, due to the free nature of Glitch it has led to a high number of Glitch based IP's getting API banned by Discord due to abuse.

i'd bet google did the same

FraWolf commented 5 years ago

I've already a server, but with glitch my music bot works better, it's a very small server (1gb ram, 20gb ssd and 1 vcore)

FraWolf commented 5 years ago

But I have a problem only when I use link, if I search a song with keywords the bot found it and reproduce it.

fent commented 5 years ago

Does running your app locally or in another environment have it work?

Stapleton commented 5 years ago

I am getting the same issue, normal old household PC. No server or anything. Residential connection in Alberta, Canada. ytdl-core: 0.29.1 node: 11.6.0 npm: 6.5.0-next.0

Just confirmed that this happens on my server as well, it is a dedicated machine through OVH in Ontario, Canada. ytdl-core: 0.29.1 node: 11.6.0 npm: 6.5.0-next.0

Stapleton commented 5 years ago

Can confirm its happening on all of them for me. Even went all the way back to 0.20.2 and same issue.

Edit: I just tested ytdl-getinfo and even it is giving me the error This video is unavailable. So I am thinking its something with our connections or youtube itself.

Edit 2: ytdl-getinfo can search for the youtube video info. Instead of getting it from a link, you can give it search words. It seems a straight up link doesnt work but I can give search terms and that works.

SpeedBoostDiscord commented 5 years ago

Germany have a lot of issues with youtube videos, I'd host elsewhere. As for Ontario, it will just be specific videos probably

Zargith commented 5 years ago

Hello! I've the same issue and I don't know why... Yesterday it was working well but today not at all ! I got the last version of ytld-core and I'm sure that not come from my connection because I can acces like I want at internet. I'm currently in France but I don't think it's the cause :/ (I say that because of reading other comments)

Personnaly I use ytdl-core for my Discord bot in JS

Zargith commented 5 years ago

Okay my bad!

That's because I was using toLowerCase method! And I did that yesterday before to go bed that's why I didn't notice it earlier 😂

npreiber commented 5 years ago

So I have a question about handling this error within an application without terminating. Whenever I get this error the program terminates rather than continuing to process videos. Is there anyway to prevent this. I've tried catching the exception in try-catch block.

AdamKearn commented 4 years ago

I am looking for a way to catch this error as well. I don't want my code to terminate when this error is presented.

fent commented 4 years ago

you can catch this error by listening to the error event from the returned stream

let stream = ytdl(url);
stream.on('error', err => {
  // handle it
});

do the following to catch uncaught errors, but it's strongly recommended to figure out where the error originates from so you can handle it properly

process.on('uncaughtException', err => {
});