updated packages + testfix video token expiry

This commit is contained in:
stratumadev 2025-08-21 20:29:31 +02:00
parent 575dedd7a4
commit 3b81ef9977
3 changed files with 285 additions and 280 deletions

View file

@ -2007,10 +2007,17 @@ export default class Crunchy implements ServiceClass {
//Handle Getting Decryption Keys if needed
if ((chosenVideoSegments.pssh_wvd ||chosenVideoSegments.pssh_prd || chosenAudioSegments.pssh_wvd || chosenAudioSegments.pssh_prd)) {
await this.refreshToken(true, true);
if (videoStream) {
await this.req.getData(`https://www.crunchyroll.com/playback/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${videoStream.token}/keepAlive?playhead=1`, {...{method: 'PATCH'}, ...AuthHeaders});
}
if (audioStream && (videoStream?.token !== audioStream.token)) {
await this.req.getData(`https://www.crunchyroll.com/playback/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${audioStream.token}/keepAlive?playhead=1`, {...{method: 'PATCH'}, ...AuthHeaders});
}
console.info(`Getting decryption keys with ${cdm}`);
// New Crunchyroll DRM endpoint for Widevine
if (cdm === 'widevine') {
await this.refreshToken(true, true);
encryptionKeysVideo = await getKeysWVD(chosenVideoSegments.pssh_wvd, api.drm_widevine, {
Authorization: `Bearer ${this.token.access_token}`,
...api.crunchyDefHeader,
@ -2023,7 +2030,6 @@ export default class Crunchy implements ServiceClass {
// Check if the audio pssh is different since Crunchyroll started to have different dec keys for audio tracks
if (chosenAudioSegments.pssh_wvd && chosenAudioSegments.pssh_wvd !== chosenVideoSegments.pssh_wvd) {
await this.refreshToken(true, true);
encryptionKeysAudio = await getKeysWVD(chosenAudioSegments.pssh_wvd, api.drm_widevine, {
Authorization: `Bearer ${this.token.access_token}`,
...api.crunchyDefHeader,
@ -2040,7 +2046,6 @@ export default class Crunchy implements ServiceClass {
// New Crunchyroll DRM endpoint for Playready
if (cdm === 'playready') {
await this.refreshToken(true, true);
encryptionKeysVideo = await getKeysPRD(chosenVideoSegments.pssh_prd, api.drm_playready, {
Authorization: `Bearer ${this.token.access_token}`,
...api.crunchyDefHeader,
@ -2053,7 +2058,6 @@ export default class Crunchy implements ServiceClass {
// Check if the audio pssh is different since Crunchyroll started to have different dec keys for audio tracks
if (chosenAudioSegments.pssh_prd && chosenAudioSegments.pssh_prd !== chosenVideoSegments.pssh_prd) {
await this.refreshToken(true, true);
encryptionKeysAudio = await getKeysPRD(chosenAudioSegments.pssh_prd, api.drm_playready, {
Authorization: `Bearer ${this.token.access_token}`,
...api.crunchyDefHeader,

View file

@ -41,15 +41,15 @@
"license": "MIT",
"dependencies": {
"@bufbuild/buf": "^1.56.0",
"@bufbuild/protobuf": "^2.6.3",
"@bufbuild/protoc-gen-es": "^2.6.3",
"@bufbuild/protobuf": "^2.7.0",
"@bufbuild/protoc-gen-es": "^2.7.0",
"@yao-pkg/pkg": "^6.6.0",
"binary-parser": "^2.2.1",
"binary-parser-encoder": "^1.5.3",
"bn.js": "^5.2.2",
"cors": "^2.8.5",
"elliptic": "^6.6.1",
"esbuild": "^0.25.8",
"esbuild": "^0.25.9",
"express": "^5.1.0",
"fast-xml-parser": "^5.2.5",
"ffprobe": "^1.1.2",
@ -64,7 +64,7 @@
"node-forge": "^1.3.1",
"ofetch": "^1.4.1",
"open": "^8.4.2",
"protobufjs": "^7.5.3",
"protobufjs": "^7.5.4",
"puppeteer-real-browser": "^1.4.3",
"ws": "^8.18.3",
"yaml": "^2.8.1",
@ -78,18 +78,18 @@
"@types/express": "^5.0.3",
"@types/ffprobe": "^1.1.8",
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.2.1",
"@types/node-forge": "^1.3.13",
"@types/node": "^24.3.0",
"@types/node-forge": "^1.3.14",
"@types/ws": "^8.18.1",
"@types/yargs": "^17.0.33",
"@typescript-eslint/eslint-plugin": "^8.39.1",
"@typescript-eslint/parser": "^8.39.1",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@typescript-eslint/parser": "^8.40.0",
"eslint": "^9.33.0",
"protoc": "^1.1.3",
"removeNPMAbsolutePaths": "^3.0.1",
"ts-node": "^10.9.2",
"typescript": "5.8.3",
"typescript-eslint": "^8.39.1"
"typescript-eslint": "^8.40.0"
},
"scripts": {
"prestart": "pnpm run tsc test",

File diff suppressed because it is too large Load diff