fent / fent/node-ytdl-core

410 status error

Open
#1,284 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.7k
Forks
852
PR merge metrics
No merged PRs in 30d

Description

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('YOUTUBE_REQUEST_COOKIES'),
'x-youtube-identity-token': this.configService.get('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](https://github.com/fent/node-ytdl-core/blob/master/example/cookies.js)). 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. (/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. (/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
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.