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

Error: Video unavailable #206

Open
nezort11 opened this issue Feb 27, 2025 · 2 comments
Open

Error: Video unavailable #206

nezort11 opened this issue Feb 27, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@nezort11
Copy link

nezort11 commented Feb 27, 2025

Describe the bug and how to reproduce it

Started getting the following error recently:

{
"name": "Error",
"message": "Video unavailable",
"stack": "Error: Video unavailable\n    at exports.playError (/app/node_modules/.pnpm/@[email protected]/node_modules/@distube/ytdl-core/lib/utils.js:174:12)\n    at exports.getBasicInfo (/app/node_modules/.pnpm/@[email protected]/node_modules/@distube/ytdl-core/lib/info.js:43:25)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
}

The code was not changed:

const videoUrl = "https://www.youtube.com/watch?v=5bId3N7QZec"; // 1 minute length

export const ytdlAgent = ytdl.createAgent(
  cookies
);

const videoInfo = await ytdl.getBasicInfo(videoUrl, { agent: ytdlAgent });

Found the following in package code:

lib/utils.js

class UnrecoverableError extends Error {}
/**
 * Checks if there is a playability error.
 *
 * @param {Object} player_response
 * @returns {!Error}
 */
exports.playError = player_response => {
  const playability = player_response?.playabilityStatus;
  if (!playability) return null;
  if (["ERROR", "LOGIN_REQUIRED"].includes(playability.status)) {
    return new UnrecoverableError(playability.reason || playability.messages?.[0]);
  }
  if (playability.status === "LIVE_STREAM_OFFLINE") {
    return new UnrecoverableError(playability.reason || "The live stream is offline.");
  }
  if (playability.status === "UNPLAYABLE") {
    return new UnrecoverableError(playability.reason || "This video is unavailable.");
  }
  return null;
};

When running locally - everything works perfectly.

Environment

  • @distube/ytdl-core version: 4.16.4
  • Node.js version: 18
  • Operating system: Ubuntu 22.04 (in data center)
@nezort11 nezort11 added the bug Something isn't working label Feb 27, 2025
@raphaguasta
Copy link

Exactly the same here! =(

@raphaguasta
Copy link

Where are you hosting? I'm on render.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants