update to youtube.js v12.0.0
This commit is contained in:
parent
6445fb5e82
commit
596713c44c
3 changed files with 1293 additions and 108 deletions
11
deno.json
11
deno.json
|
@ -1,17 +1,16 @@
|
||||||
{
|
{
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"dev": "deno run --allow-net --allow-env --allow-sys=hostname --allow-read --allow-write=/var/tmp/youtubei.js --watch src/main.ts",
|
"dev": "deno run --allow-import=github.com:443,jsr.io:443,raw.githubusercontent.com:443,esm.sh:443,deno.land:443 --allow-net --allow-env --allow-sys=hostname --allow-read --allow-write=/var/tmp/youtubei.js --watch src/main.ts",
|
||||||
"compile": "deno compile --output invidious_companion --allow-net --allow-env --allow-read --allow-sys=hostname --allow-write=/var/tmp/youtubei.js src/main.ts"
|
"compile": "deno compile --output invidious_companion --allow-import=github.com:443,jsr.io:443,raw.githubusercontent.com:443,esm.sh:443,deno.land:443 --allow-net --allow-env --allow-read --allow-sys=hostname --allow-write=/var/tmp/youtubei.js src/main.ts"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
"hono": "jsr:@hono/hono@^4.6.5",
|
"hono": "jsr:@hono/hono@^4.6.5",
|
||||||
"hono/logger": "jsr:@hono/hono@^4.6.5/logger",
|
"hono/logger": "jsr:@hono/hono@^4.6.5/logger",
|
||||||
"hono/bearer-auth": "jsr:@hono/hono@^4.6.5/bearer-auth",
|
"hono/bearer-auth": "jsr:@hono/hono@^4.6.5/bearer-auth",
|
||||||
"youtubei.js": "https://deno.land/x/youtubei@v11.0.1-deno/deno.ts",
|
"youtubei.js": "https://raw.githubusercontent.com/LuanRT/YouTube.js/refs/tags/v12.0.0-deno/deno.ts",
|
||||||
"youtubei.js/endpoints": "https://deno.land/x/youtubei@v11.0.1-deno/deno/src/core/endpoints/index.ts",
|
"youtubei.js/Utils": "https://raw.githubusercontent.com/LuanRT/YouTube.js/refs/tags/v12.0.0-deno/deno/src/utils/Utils.ts",
|
||||||
"youtubei.js/Utils": "https://deno.land/x/youtubei@v11.0.1-deno/deno/src/utils/Utils.ts",
|
|
||||||
"jsdom": "https://esm.sh/jsdom@25.0.1",
|
"jsdom": "https://esm.sh/jsdom@25.0.1",
|
||||||
"bgutils": "https://esm.sh/bgutils-js@3.0.0",
|
"bgutils": "https://esm.sh/bgutils-js@3.1.0",
|
||||||
"estree": "https://esm.sh/@types/estree@1.0.6",
|
"estree": "https://esm.sh/@types/estree@1.0.6",
|
||||||
"@willsoto/node-konfig-core": "npm:@willsoto/node-konfig-core@5.0.0",
|
"@willsoto/node-konfig-core": "npm:@willsoto/node-konfig-core@5.0.0",
|
||||||
"@willsoto/node-konfig-file": "npm:@willsoto/node-konfig-file@3.0.0",
|
"@willsoto/node-konfig-file": "npm:@willsoto/node-konfig-file@3.0.0",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Innertube, ApiResponse } from "youtubei.js";
|
import { Innertube, ApiResponse } from "youtubei.js";
|
||||||
import { PlayerEndpoint } from "youtubei.js/endpoints";
|
|
||||||
import { Store } from "@willsoto/node-konfig-core";
|
import { Store } from "@willsoto/node-konfig-core";
|
||||||
|
|
||||||
export const youtubePlayerReq = async (innertubeClient: Innertube, videoId: string, konfigStore: Store): Promise<ApiResponse> => {
|
export const youtubePlayerReq = async (innertubeClient: Innertube, videoId: string, konfigStore: Store): Promise<ApiResponse> => {
|
||||||
|
@ -11,13 +10,11 @@ export const youtubePlayerReq = async (innertubeClient: Innertube, videoId: stri
|
||||||
if (innertubeClientOauthEnabled)
|
if (innertubeClientOauthEnabled)
|
||||||
innertubeClientUsed = "TV";
|
innertubeClientUsed = "TV";
|
||||||
|
|
||||||
return await innertubeClient.actions.execute(
|
return await innertubeClient.actions.execute('/player', {
|
||||||
PlayerEndpoint.PATH, PlayerEndpoint.build({
|
|
||||||
video_id: videoId,
|
video_id: videoId,
|
||||||
// @ts-ignore Unable to import type InnerTubeClient
|
// @ts-ignore Unable to import type InnerTubeClient
|
||||||
client: innertubeClientUsed,
|
client: innertubeClientUsed,
|
||||||
sts: innertubeClient.session.player?.sts,
|
sts: innertubeClient.session.player?.sts,
|
||||||
po_token: innertubeClient.session.po_token
|
po_token: innertubeClient.session.po_token
|
||||||
})
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue