-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Request to https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json failed with status 400 #803
Comments
it was working since yesterday |
Yesterday it was still running, only recently did it start to have such an error. |
Same thing here, we started encountering this error around 24 hours ago. It was working fine before that. |
I believe this issue is the same as yt-dlp/yt-dlp#11462 If YouTube is limiting the current OAuth sign-in to just the TV client, then I suppose we'd have to return to passing cookies. I hope I'm wrong - the OAuth method is really convenient for users. |
started getting the same error today aswell |
Hello, good day, I think the same, we should each implement a personalized OAuth authentication or, as you mentioned, use cookies. I don't have experience with cookies, so I would appreciate it if you could provide me with an example of how to obtain those session cookies and use them for authentication. |
I have already tried using a custom OAuth, and for now, it seems to solve this error. However, it might be necessary to learn how to use cookies if we want to perform operations without YouTube's consumption limits. |
Como coloca esse OAuth personalizado, tem exemplo de código? |
Yes, there is an example in the official YouTube.js documentation. I basically copied and pasted it to test if it would work. Here is the link: https://github.com/LuanRT/YouTube.js/blob/main/examples/auth/custom-oauth2-creds/index.ts |
I have written a guide on how to get the cookie value. So, after getting the value, you pass it like this:
Interesting. Appreciate if you could share the process too? |
What might be a bit complicated is obtaining the OAuth credentials.
This video can guide you, it's not about OAuth, but the steps are the same, you just need to choose 'OAuth ID' in credentials. |
Será que vai ter uma atualização na biblioteca que resolva, ou precisamos mexer no código? |
No, I know, but I recommend starting to learn about these settings. |
Custom OAuth could be an effective solution too. I remember creating a few for use with the official YouTube API a couple years back. Then came this project that made everything so much more simple and powerful 😍 |
Envie seu código aqui pra eu ver como devo fazer |
I am going to opt for using cookies. I have conducted some tests as you indicated, and I must say it works. However, I have a question: how can I obtain data from a specific channel? For instance, I have two channels on my YouTube account, the main one and a secondary one. By passing the cookies, I only get data from my main user, but I want to access my secondary channel. Is there any way to do this using cookies? |
Can any of you tell what is missing in my function, I tried using cookies: case 'play2': {
} |
The error says the audio format was not found |
How do I use cookies?, I used cookies before but I have to change my cookies frequently, is there a way to solve that? |
@LArroyoS Does that not require google to approve you? |
I am getting the same error :( |
No, you do not need YouTube to approve your app unless you need to store more than 100 users. |
Thanks! This method worked for me. |
The first time I try, it's successful, but the streaming links give me a 403 error. When I try again, I get this error. |
Previously I used Oauth but now it's no longer possible, and I tried using cookies, previously it was possible but now for some reason it can no longer respond to the code always asking for login, I have used txt/json and it's still the same, this is the code I used, can anyone help me? `const { Innertube, Utils } = require('youtubei.js'); function extractVideoId(url) { async function youtubeAudio(audioUrl) {
} catch (err) { And
} catch (err) { |
You're probably not passing in PoTokens. It is required when requesting video info with the |
And about this; get your cookies from an incognito tab. If you extract it from a normal session, YouTube will eventually rotate it when you open the website again and invalidate your old cookies. Sign in, get them, and then close it immediately. |
I second this. The cookie I obtained early last week is still working today :) |
@LArroyoS , I've submitted a PR that will facilitate switching channels for cookie-based session. |
When I want to create a client, I set poToken. Isn't that enough? example:
Thank you for explaining with an example. |
Youtube TV seems no longer have scope for reading history or account details? Cookie may work and custom oauth seems most stable based on reporting from LuanRT/YouTube.js#803
How to fix this error?
Error: InnertubeError: Request to https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json failed with status 400
at HTTPClient.fetch (/home/ubuntu/scrape/node_modules/youtubei.js/bundle/node.cjs:2074:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Actions.execute (/home/ubuntu/scrape/node_modules/youtubei.js/bundle/node.cjs:24255:22) at async Innertube.getBasicInfo (/home/ubuntu/scrape/node_modules/youtubei.js/bundle/node.cjs:29778:22)
at async Innertube.download (/home/ubuntu/scrape/node_modules/youtubei.js/bundle/node.cjs:29988:18)
at async /home/ubuntu/scrape/ytm4.js:61:20 {
info: '{\n' +
' "error": {\n' +
' "code": 400,\n' +
' "message": "Request contains an invalid argument.",\n' +
' "errors": [\n' +
' {\n' +
' "message": "Request contains an invalid argument.",\n' +
' "domain": "global",\n' +
' "reason": "badRequest"\n' +
' }\n' +
' ],\n' +
' "status": "INVALID_ARGUMENT"\n' +
' }\n' +
'}\n',
date: 2024-11-15T09:16:23.932Z,
version: '11.0.1'
The text was updated successfully, but these errors were encountered: