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

9.2.0 Posts a comment with error 403

Open meghe2000 opened this issue 10 months ago • 5 comments

Steps to reproduce

import { ClientType, Innertube } from 'youtubei.js';

async function start() { const yt = await Innertube.create( { client_type: ClientType.WEB, cookie: "my browser cookie..." } ); const vid = 'ZiplxPdOJd4';

const com = await yt.interact.comment(vid, 'GOOD');
console.log(com.data);

}

start();

Failure Logs

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

InnertubeError: Request to https://www.youtube.com/youtubei/v1/comment/create_comment?prettyPrint=false&alt=json failed with status 403
    at HTTPClient.<anonymous> (node_modules/youtubei.js/dist/src/utils/HTTPClient.js:101: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": 403,\n' +
    '    "message": "Comment failed to post.",\n' +
    '    "status": "PERMISSION_DENIED"\n' +
    '  }\n' +
    '}\n',
  date: 2024-04-10T12:53:30.800Z,
  version: '9.2.0'
}

Node.js v18.16.0

Expected behavior

Send a comment and get the result.

Current behavior

Not sending the comment while other functions like getHomeFeed works fine.

Version

Default

Anything else?

No response

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 Apr 10 '24 13:04 meghe2000