Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinigetError: Status code: 410 #985

Closed
erick-gomes opened this issue Aug 5, 2021 · 25 comments
Closed

MinigetError: Status code: 410 #985

erick-gomes opened this issue Aug 5, 2021 · 25 comments

Comments

@erick-gomes
Copy link

MinigetError: Status code: 410
at ClientRequest. (/app/node_modules/miniget/src/index.ts:257:19)
at Object.onceWrapper (events.js:520:26)
at ClientRequest.emit (events.js:400:28)
at ClientRequest.emit (domain.js:470:12)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:400:28)
at TLSSocket.emit (domain.js:470:12)
at addChunk (internal/streams/readable.js:290:12) {
statusCode: 410
}

@N1C0exe
Copy link

N1C0exe commented Aug 5, 2021

Its seems that this error is similar too 404 error so you can simple try to use cookie . Also try to play this video https://www.youtube.com/watch?v=dmJefsOErr0 (is a age restricted video ) and reply here the results

@erick-gomes
Copy link
Author

import { getURLVideoID, getInfo, validateURL, downloadFromInfo } from 'ytdl-core'
import yts from 'yt-search'
/*
    Age restriction information is reported only after the error, if the restriction is active, I will never know that the error was 
    caused by the restriction.
*/
(async () => {
   try {
          const video = (await yts(search)).videos.slice(0, 3)[0]
          const videoId = getURLVideoID('https://www.youtube.com/watch?v=dmJefsOErr0') // restricted video
          const info = await getInfo(videoId) // The error happens on this line due to the age restriction
          if (video.seconds > 300) {
              msg.reply('Escolha outro vídeo, esse é muito grande.')
              return
          }
          
          // this alert message about the age restriction
          info.videoDetails.age_restricted && msg.reply('⚠️Aviso! Esse vídeo tem restrição de idade!') 
          
          
          console.log(info)
    } catch (err) {
        console.log(err) // output MinigetError Status code 410
    }
})()



// https://www.youtube.com/watch?v=YVJijQIualA , an unrestricted video has the normal output like this:


author: {
      id: 'UCxVxcprt9bqQQ-95sMLLRoQ',
      name: 'Midas Music',
      user: 'MidasBrasil',
      channel_url: 'https://www.youtube.com/channel/UCxVxcprt9bqQQ-95sMLLRoQ',
      external_channel_url: 'https://www.youtube.com/channel/UCxVxcprt9bqQQ-95sMLLRoQ',
      user_url: 'http://www.youtube.com/user/MidasBrasil',
      thumbnails: [Array],
      verified: false,
      subscriber_count: 3140000
    },
    isPrivate: false,
    isUnpluggedCorpus: false,
    isLiveContent: false,
    media: {
      song: 'O Sol',
      category: 'Music',
      category_url: 'https://music.youtube.com/',
      artist: 'Vitor Kley',
      'licensed to youtube by': 'UMPI, UNIAO BRASILEIRA DE EDITORAS DE MUSICA - UBEM, LatinAutorPerf, UMPG Publishing, BMI - Broadcast Music Inc., LatinAutor - UMPG, and 6 Music Rights Societies'
    },
    likes: 2527089,
    dislikes: 86030,
    age_restricted: false,
    video_url: 'https://www.youtube.com/watch?v=YVJijQIualA',
    storyboards: [ [Object], [Object], [Object] ],
    chapters: [],
    thumbnails: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  

@N1C0exe
Copy link

N1C0exe commented Aug 5, 2021

Try to use cookie https://github.com/fent/node-ytdl-core/blob/master/example/cookies.js ( here official example ).

Here an community example #980 (comment)

@r0hin
Copy link

r0hin commented Aug 18, 2021

Having the same issue. Happens with specific videos on certain devices. IE, locally, it's fine but on a Google Cloud Run instance, throws the error.

@ProGamer2711
Copy link

I have the same issue. When I have to play an age restricted video my discord bot crashes. tried the cookie example but it still won't work. Can anybody please help.

@gabcaua
Copy link

gabcaua commented Aug 19, 2021

All the videos are returning me this error

@face-hh
Copy link

face-hh commented Aug 21, 2021

same here, with the example from README.md

@carlosalcina
Copy link

same here, any solution?

@Claxtastic
Copy link

also getting this error for many videos. Restarting my app will often resolve the issue, but I'm not sure what to do other than that.

@Twometer
Copy link

I get the error as well on an age-restricted video, even with all the cookies and identity tokens in place

@r0hin
Copy link

r0hin commented Aug 27, 2021

also getting this error for many videos. Restarting my app will often resolve the issue, but I'm not sure what to do other than that.

Yes. Restarting will often get the request working again which suggests it's a bug or missing feature.

Can anyone investigate? @fent

@lollipop-0
Copy link

I also have the problem with age-restricted videos with the .getBasicInfo() function. The problem is, there is no way to check if they are age restricted because checking them will get you the error.

You can prevent the crash with a try ... catch statement.

@PhanNN
Copy link

PhanNN commented Sep 3, 2021

If you guys just want to download the mp3 file only.
I suggest you should use a fallback solution if node-ytdl doesn't work
I try to use "https://www.yt-download.org/developers", get the mp3 links from html response and download by miniget (or another lib)

Good luck!

@r0hin
Copy link

r0hin commented Sep 6, 2021

If you guys just want to download the mp3 file only.
I suggest you should use a fallback solution if node-ytdl doesn't work
I try to use "https://www.yt-download.org/developers", get the mp3 links from html response and download by miniget (or another lib)

Good luck!

For anyone who needs a simple implementation of the above fallback solution, here is mine:

response = await fetch(`https://www.yt-download.org/api/button/mp3/${youtubeID}}`);
text = await response.text();
url = text.split('<a href="')[1].split('" class="shadow-xl')[0];```

@basserd
Copy link

basserd commented Oct 4, 2021

Still having this error. Seems to be kinda random for me, restarting the application often helps. I also have the error with the age restricted video.

@sayho93
Copy link

sayho93 commented Oct 8, 2021

I'm getting this error when playing Youtube-music video. Also, inside ytdl-core/index.js returns status: 'UNPLAYABLE',
reason: 'Video unavailable'
any updates on this problem?

@nikolaigeorgie
Copy link

Getting this issue randomly in my ec2 instance with aws.. no cookies or headers.

@leon20121005
Copy link

Also getting this issue for all videos on Heroku.
const information = await ytdl.getInfo(url);
image

@nikolaigeorgie
Copy link

@leon20121005 i switched my queue to a new redis instance and that got it working. seems like after a certain amount of requests could be youtube is rate limiting..

@leon20121005
Copy link

@nikolaigeorgie Well... I just added error handlings without changing its functionality and got it working too lol.

@nikolaigeorgie
Copy link

switched to https://www.npmjs.com/package/youtube-dl-exec ... good alternative

@nikolaigeorgie
Copy link

switched to https://www.npmjs.com/package/youtube-dl-exec ... good alternative

youtube-dl-exec package behaves much slower than this package.. sigh , oh miniget ... lol

@nicocespede
Copy link

nicocespede commented Nov 29, 2021

@nikolaigeorgie Well... I just added error handlings without changing its functionality and got it working too lol.

Could you tell me how you handled those errors please? I started getting this error last night and I can't fix it, I'm hosting my bot on Heroku

@nikolaigeorgie
Copy link

@nicocespede i have no solution to this issue yet. i've switched to https://www.npmjs.com/package/youtube-dl-exec for now

@TimeForANinja
Copy link
Collaborator

should be fixed with #1022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests