-
Notifications
You must be signed in to change notification settings - Fork 50
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
Getting an error on VERCEL but working fine on Google cloud run and localhost #113
Comments
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
}
}) |
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?
The text was updated successfully, but these errors were encountered: