Skip to content

Commit

Permalink
feat(ytm): Re-implement auth with cookie and oauth
Browse files Browse the repository at this point in the history
Youtube TV seems no longer have scope for reading history or account details?

Cookie may work and custom oauth seems most stable based on reporting from LuanRT/YouTube.js#803
  • Loading branch information
FoxxMD committed Dec 3, 2024
1 parent eb26ee0 commit 7faf94c
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 24 deletions.
200 changes: 190 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"fixed-size-list": "^0.3.0",
"formidable": "^3.5",
"glob": "^11.0.0",
"google-auth-library": "^9.15.0",
"gotify": "^1.1.0",
"iso-websocket": "^0.3.0",
"iti": "^0.6.0",
Expand Down Expand Up @@ -111,7 +112,7 @@
"vite-express": "^0.16.0",
"vlc-client": "^1.1.1",
"xml2js": "0.6.1",
"youtubei.js": "^10.5.0"
"youtubei.js": "^11.0.1"
},
"devDependencies": {
"@dbus-types/notifications": "^0.0.5",
Expand Down
19 changes: 19 additions & 0 deletions src/backend/common/infrastructure/config/source/ytmusic.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
import { PollingOptions } from "../common.js";
import { CommonSourceConfig, CommonSourceData, CommonSourceOptions } from "./index.js";
import { Innertube } from 'youtubei.js';

//type InnertubeOptions = Omit<Parameters<typeof Innertube.create>[0], 'cookie' | 'cache' | 'fetch'>;

export interface YTMusicData extends CommonSourceData, PollingOptions {
/**
* The cookie retrieved from the Request Headers of music.youtube.com after logging in.
*
* See https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html#copy-authentication-headers for how to retrieve this value.
*
* @examples ["VISITOR_INFO1_LIVE=jMp2xA1Xz2_PbVc; __Secure-3PAPISID=3AxsXpy0M/AkISpjek; ..."]
* */
cookie?: string

clientId?: string

clientSecret?: string

redirectUri?: string
}
//export type YTMusicData = YTMusicDataCommon & InnertubeOptions;

export interface YTMusicSourceConfig extends CommonSourceConfig {
data?: YTMusicData
options?: CommonSourceOptions & {
Expand Down
Loading

0 comments on commit 7faf94c

Please sign in to comment.