Closed altr closed 4 days ago
Same here, it's working in local, but not working from Vercel, Google cloud functions and Digital Ocean Server. Any Idea why or how to fix it ?
Same here
It's prob getting blocked, this happened on another library, I was hoping to switch here to avoid it, but ig not.
Yep tried in youtube-sr too
Your IP most likely got banned by google, there's nothing that I can do about this unfortunately.
However, I've implemented OAuth into this library, which allows you to send authenticated request, I used this too on my server (because my server got IP banned too) and it has been working fine. Usage:
const client = new Client({
oauth: {
enabled: true,
refreshToken: "optional", // optional if you already have a refresh token
}
})
Your IP most likely got banned by google, there's nothing that I can do about this unfortunately.
However, I've implemented OAuth into this library, which allows you to send authenticated request, I used this too on my server (because my server got IP banned too) and it has been working fine. Usage:
const client = new Client({ oauth: { enabled: true, refreshToken: "optional", // optional if you already have a refresh token } })
Is there any way to have multiple tokens ? I have a list of cookies and would like to use it with youtubei for a big API
I'm not sure if I'm going to implement that into the library, I feel like it's out of the library's scope, but I'll consider it.
The closest thing you can do right now is to create multiple youtubei client and roll them
Example (not tested):
import { Client } from "youtubei";
const refreshTokens = ["...", "...", "..."];
const clients = refreshTokens.map(refreshToken => new Client({
oauth: {
enabled: true,
refreshToken,
}
}));
const videoIds = ["...", "...", "..."];
let currentClientIndex = 0;
const getVideo = async (videoId: string) => {
if (currentClientIndex >= clients.length) {
currentClientIndex = 0;
}
const client = clients[currentClientIndex];
return client.getVideo(videoId);
}
for (const videoId of videoIds) {
getVideo(videoId).then(video => {
console.log(video.title);
}).catch(console.error);
}
Yeah great idea thanks!
Describe the bug I don't know whether it's a bug, however when hosting on VERCEL I'm consistently getting an error for
const video = await youtube.getVideo(id).
This issue doesn't occur on localhost and when hosted on Google Cloud Run. The exact error message is:Cannot read properties of undefined (reading 'videoId')
Additional context This wasn't happening 4 weeks ago as this worked fine in the past. Could IP/Proxy or similar factors play a role here?