YouTube.js icon indicating copy to clipboard operation
YouTube.js copied to clipboard

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

Open meghe2000 opened this issue 11 months ago • 8 comments

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

  • [X] I am running the latest version.
  • [X] I checked the documentation and found no answer.
  • [X] I have searched the existing issues and made sure this is not a duplicate.
  • [X] I have provided sufficient information.

meghe2000 avatar Mar 20 '24 10:03 meghe2000