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

<9.1.0> <InnertubeError: Request to https://www.youtube.com/youtubei/... failed with status 400> #621

Open
4 tasks done
meghe2000 opened this issue Mar 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@meghe2000
Copy link

meghe2000 commented Mar 20, 2024

Steps to reproduce

`
import { Innertube, UniversalCache } from 'youtubei.js';

async function start() {
const yt = await Innertube.create();
const search = await yt.search('test', { duration: 'all', type: 'all', upload_date: 'all' });
console.log(search);

}

start();
`

Failure Logs

/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:99
            throw new InnertubeError(`Request to ${response.url} failed with status ${response.status}`, yield response.text());
                  ^

InnertubeError: Request to https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8&prettyPrint=false&alt=json failed with status 400
    at HTTPClient.<anonymous> (/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:99:19)
    at Generator.next (<anonymous>)
    at fulfilled (\node_modules\tslib\tslib.js:166:62)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  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-03-20T10:34:45.430Z,
  version: '9.1.0'
}

Node.js v18.16.0

Expected behavior

log search result

Current behavior

error 400.

Version

Default

Anything else?

async function test() { const r = await fetch('https://youtube.com'); console.log(await r.text()); } test();

// It returns the result and connects to the YouTube site.

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
@meghe2000 meghe2000 added the bug Something isn't working label Mar 20, 2024
@LuanRT
Copy link
Owner

LuanRT commented Mar 25, 2024

Does this always happen or was it a one time case? If it does, then we might have to look at what the library is sending.

@jason-hwang
Copy link

jason-hwang commented Mar 25, 2024

@LuanRT
Copy link
Owner

LuanRT commented Mar 25, 2024

same here!

Request to https://www.youtube.com/youtubei/vtrue/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8&prettyPrint=false&alt=json failed with status 400

Hi! Yours is a different issue that has already been fixed. Try updating YouTube.js to the latest version.

@jason-hwang
Copy link

jason-hwang commented Mar 26, 2024

@LuanRT
Oh, sorry. I confused the problem with the same phenomenon with a similar error code. and also I've fixed the issue with the latest version. thank you so much for your quick reply.

Have a nice day.

@meghe2000
Copy link
Author

Does this always happen or was it a one time case? If it does, then we might have to look at what the library is sending.

Sometimes this problem occurs.
And if I use VPN with another location, I have no problem.

@retrouser955
Copy link

Same problem here

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

4 participants