fix(Innertube): Handle redirects in getChannel() (#1002)

This commit is contained in:
absidue
2025-07-22 19:49:35 +00:00
committed by GitHub
parent d9eb00544e
commit cb87cc1cae

View File

@@ -19,6 +19,7 @@ import {
} from './parser/youtube/index.js';
import { ShortFormVideoInfo } from './parser/ytshorts/index.js';
import { NavigateAction } from './parser/continuations.js';
import NavigationEndpoint from './parser/classes/NavigationEndpoint.js';
import type Format from './parser/classes/misc/Format.js';
@@ -390,8 +391,13 @@ export default class Innertube {
async getChannel(id: string): Promise<Channel> {
throwIfMissing({ id });
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: id } });
const response = await browse_endpoint.call(this.#session.actions);
return new Channel(this.actions, response);
let response = await browse_endpoint.call<IBrowseResponse>(this.#session.actions, { parse: true });
if (response.on_response_received_actions?.[0].is(NavigateAction)) {
response = await response.on_response_received_actions[0].endpoint.call<IBrowseResponse>(this.#session.actions, { parse: true });
}
return new Channel(this.actions, response, true);
}
async getNotifications(): Promise<NotificationsMenu> {