[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

feat(ytmusic): Add more innertube options to user configuration

FoxxMD (Dec 4, 2024, 7:38 PM UTC) 4de28e03 f74721b3

+62 -6
+7 -2
src/backend/sources/YTMusicSource.ts
··· 3 3 import { PlayObject } from "../../core/Atomic.js"; 4 4 import { FormatPlayObjectOptions, InternalConfig } from "../common/infrastructure/Atomic.js"; 5 5 import { YTMusicSourceConfig } from "../common/infrastructure/config/source/ytmusic.js"; 6 - import { Innertube, UniversalCache, Parser, YTNodes, ApiResponse, IBrowseResponse, Log } from 'youtubei.js'; 6 + import { Innertube, UniversalCache, Parser, YTNodes, ApiResponse, IBrowseResponse, Log, SessionOptions } from 'youtubei.js'; 7 7 import { OAuth2Client } from 'google-auth-library'; 8 8 import {resolve} from 'path'; 9 9 import { joinedUrl, sleep } from "../utils.js"; ··· 92 92 } 93 93 94 94 protected async doBuildInitData(): Promise<true | string | undefined> { 95 + const { 96 + cookie, 97 + innertubeOptions = {}, 98 + } = this.config.data || {}; 95 99 this.yti = await Innertube.create({ 96 - ...this.config.data, 100 + ...(innertubeOptions as SessionOptions), 101 + cookie, 97 102 cache: new UniversalCache(true, this.workingCredsPath) 98 103 }); 99 104 this.yti.session.on('update-credentials', async ({ credentials }) => {
+55 -4
src/backend/common/infrastructure/config/source/ytmusic.ts
··· 1 1 import { PollingOptions } from "../common.js"; 2 2 import { CommonSourceConfig, CommonSourceData, CommonSourceOptions } from "./index.js"; 3 - import { Innertube } from 'youtubei.js'; 4 3 5 - //type InnertubeOptions = Omit<Parameters<typeof Innertube.create>[0], 'cookie' | 'cache' | 'fetch'>; 4 + export interface InnertubeOptions { 5 + /** 6 + * Proof of Origin token 7 + * 8 + * May be required if YTM starts returning 403 9 + * 10 + * @see https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide 11 + */ 12 + po_token?: string 13 + 14 + /** 15 + * Visitor ID value found in VISITOR_INFO1_LIVE or visitorData cookie 16 + * 17 + * May be required if YTM starts returning 403 18 + * 19 + * @see https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide 20 + */ 21 + visitor_data?: string 22 + 23 + /** 24 + * If account login results in being able to choose multiple account, use a zero-based index to choose which one to monitor 25 + * 26 + * @examples [0,1] 27 + */ 28 + account_index?: number 29 + 30 + location?: string 31 + lang?: string 32 + generate_session_locally?: boolean 33 + device_category?: string 34 + client_type?: string 35 + timezone?: string 36 + } 6 37 7 38 export interface YTMusicData extends CommonSourceData, PollingOptions { 8 - /** 39 + /** 9 40 * The cookie retrieved from the Request Headers of music.youtube.com after logging in. 10 41 * 11 42 * See https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html#copy-authentication-headers for how to retrieve this value. ··· 14 45 * */ 15 46 cookie?: string 16 47 48 + /** 49 + * Google Cloud Console project OAuth Client ID 50 + * 51 + * Generated from a custom OAuth Client, see docs 52 + */ 17 53 clientId?: string 18 54 55 + /** 56 + * Google Cloud Console project OAuth Client Secret 57 + * 58 + * Generated from a custom OAuth Client, see docs 59 + */ 19 60 clientSecret?: string 20 61 62 + /** 63 + * Google Cloud Console project OAuth Client Authorized redirect URI 64 + * 65 + * Generated from a custom OAuth Client, see docs. multi-scrobbler will generate a default based on BASE_URL. 66 + * Only specify this if the default does not work for you. 67 + */ 21 68 redirectUri?: string 69 + 70 + /** 71 + * Additional options for authorization and tailoring YTM client 72 + */ 73 + innertubeOptions?: InnertubeOptions 22 74 } 23 - //export type YTMusicData = YTMusicDataCommon & InnertubeOptions; 24 75 25 76 export interface YTMusicSourceConfig extends CommonSourceConfig { 26 77 data?: YTMusicData