LuanRT / YouTube.js

A JavaScript client for YouTube's private API, known as InnerTube.
https://ytjs.dev
MIT License
3.56k stars 226 forks source link

10.5.0 - Getting a 400 whenever trying to get account settings suddenly with multiple accounts. They all used to work a few days ago #783

Open MrGrasss opened 3 hours ago

MrGrasss commented 3 hours ago

Steps to reproduce

const yt = await Innertube.create()

yt.session.on("auth", async (data: any) => { const message = "Successfully signed in!"; yt.session.logged_in = true; console.log(message);

    let accInfo: AccountInfo;
    let settings: Settings;
    let channel_id = null;
    let restricted = false;
    let ipBanned = false;

    try {
        accInfo = await yt.account.getInfo();
        settings = await yt.account.getSettings();

        const args = {
            browseId: "SPaccount_advanced",
            parse: true as const
        };

        const response = await yt.actions.execute('/browse', args);

        channel_id = [...response.contents_memo.get('ItemSection')]
            .flatMap(item => item["contents"])
            .find(option => option.type === 'SettingsOptions' && option.title.text === 'Channel ID')?.options[0]?.short_url;

    } catch (error) {
        // Account is restricted on 403
        if (error.code === 403) {
            console.error("Account Restricted:", error.code || error.message || error);
            restricted = true;
        } else {
            console.error("Account might have banned this ip or shadowbanned:", error.code || error.message || error);
            ipBanned = true;
        }
    }

await yt.session.signIn(auth_key);

Failure Logs

https://www.youtube.com/youtubei/v1/account/accounts_list?prettyPrint=false&alt=json failed with status 400

Expected behavior

Getting the account settings with a appropriate error message

Current behavior

Getting 400 when trying to get the account settings

Version

Default

Anything else?

No response

Checklist

PurrsonalPawtrait commented 3 hours ago

I am getting the same error, been trying to fix it for a while nothing seems to work.