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

410 status error #1284

Open
Jagmesh opened this issue May 3, 2024 · 9 comments
Open

410 status error #1284

Jagmesh opened this issue May 3, 2024 · 9 comments

Comments

@Jagmesh
Copy link

Jagmesh commented May 3, 2024

Greetings!

I have, and it seems many of you too, a 410 Error.

This is the request that fails

    const videoInfo = await ytdl
      .getBasicInfo(url, {
        requestOptions: {
          headers: {
            cookie: this.configService.get<string>('YOUTUBE_REQUEST_COOKIES'),
            'x-youtube-identity-token': this.configService.get<string>('YOUTUBE_ID_TOKEN'),
          },
        },
      })
  1. There was no problem when I started to use ytdl and downloading videos/getting info. But after sometime, about a week, all requests began failing with 410 code error ([2024-05-03 21:58:40]: [ERROR][YOUTUBE_DOWNLOAD] Error: Status code: 410)
  2. Interesting part is that it doesn't work with any video I try. But everything works fine, when I ran an app on my PC. But when I upload it to the server, every .getBasicInfo request fails
  3. I tried to add COOKIE (as shown here). And it helped! But not for long. After 5-6 requests and ~hour passed, it began to respond with 410 again

So, I'm starting to suspect, that it is all due to IP. When I'm using the same app on my PC it all works, but it doesnt work on a remote server with a static IP

Could this be the problem? If yes, is there any suggestions on how it can be avoided?

"ytdl-core": "^4.11.5"

Full error (the same on both .getBasicInfo or on the ytdl(url) itself)

Error: Input stream error: Status code: 410
    at PassThrough.<anonymous> (/app/node_modules/fluent-ffmpeg-7/lib/processor.js:451:34)
    at PassThrough.emit (node:events:518:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  inputStreamError: MinigetError: Status code: 410
      at ClientRequest.<anonymous> (/app/node_modules/miniget/dist/index.js:206:27)
      at Object.onceWrapper (node:events:633:26)
      at ClientRequest.emit (node:events:518:28)
      at HTTPParser.parserOnIncomingClient (node:_http_client:698:27)
      at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
      at TLSSocket.socketOnData (node:_http_client:540:22)
      at TLSSocket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:559:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
      at Readable.push (node:internal/streams/readable:390:5)
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
    statusCode: 410
  }
}
@Jagmesh
Copy link
Author

Jagmesh commented May 3, 2024

And I have refreshed COOKIES and it seems to be working again. At least for now

That's some black magic here

@Jagmesh
Copy link
Author

Jagmesh commented May 4, 2024

After I refreshed COOKIES, requests worked for sometime. But now I am havin a 410 error again

Maybe anyone faced a same problem? What can be done to avoid this 410 error permanently?

@Finalet
Copy link

Finalet commented May 4, 2024

Experiencing the same issue. Works fine on a local machine, but throws 410 when deployed to a server

@Jagmesh
Copy link
Author

Jagmesh commented May 5, 2024

Experiencing the same issue. Works fine on a local machine, but throws 410 when deployed to a server

Have you tesed with cookies added/removed?

@cemalct
Copy link

cemalct commented May 9, 2024

I'm having this as well, any work around?

@Jagmesh
Copy link
Author

Jagmesh commented May 9, 2024

@cemalct I have been actively testing and have come to a conclusion that it has nothing to do with the ytdl-core package itself. I have tested diffrent libs and also use yt-dlp natively and all of them result in the same way: the 410 Error

So I believe that it's the problem with Youtube itself

And yet maybe anyone has any ideas for a work around? :D

The cookies stuff is working quite unstable

@cemalct
Copy link

cemalct commented May 9, 2024

then i think the only way to download is, streaming video byte byte into a file

@Finalet
Copy link

Finalet commented May 10, 2024

It seems like YouTube is just getting tired of our requests. Using ytdl through a proxy solved the issue.

@aymenitc
Copy link

aymenitc commented Jun 7, 2024

It seems like YouTube is just getting tired of our requests. Using ytdl through a proxy solved the issue.

Can you plz give an examble code how to do it

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

4 participants