fent / fent/node-ytdl-core

Error: Video unavailable

Open
#888 1 comment 6 reactions 0 assignees View on GitHub
needs more info support
Dominant language
JavaScript
Stars
4.7k
Forks
852
PR merge metrics
No merged PRs in 30d

Description

About 5% of video URL's throw an error.
```
Error: Video unavailable at Object.exports.playError (/usr/src/app/node_modules/ytdl-core/lib/utils.js:124:12) at downloadFromInfoCallback (/usr/src/app/node_modules/ytdl-core/lib/index.js:72:19) at /usr/src/app/node_modules/ytdl-core/lib/index.js:20:5 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)
```

**Version**
```
$ npm ls ytdl-core
└── ytdl-core@4.5.0
```

An example URL which reproducibly fails: [youtube.com/watch?v=0NChtZCDCsY](https://www.youtube.com/watch?v=0NChtZCDCsY)

Weirdly, it works just fine on my local machine (in Canada), but fails when deployed to Google Cloud Run on US-West. However the video in question should be available in the United States, and the errors still persist when downloading through a Canadian proxy server, so I don't believe country restrictions is the issue.

When checking for formats with:
```
ytdl.getInfo(url).then(res => {
console.dir(res.formats);
});
```

any empty array `[]` is printed.

A _simplified_ snippet of my code:

```
ytdl.getInfo(url).then(res => {
const audioFormats = ytdl.filterFormats(res.formats, "audioonly");

const download = ytdl(url, {
quality: audioFormats.length > 0 ? "highestaudio" : "lowestvideo"
}).on("error", err => {
console.error(`Failed to download ${url}`);
console.error(err);
});
});
```

Any ideas?

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.