mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-04-21 08:21:56 +00:00
added crunchyroll token refresh check before key req to avoid auth errors
This commit is contained in:
parent
8f98ae55b1
commit
212113de1f
1 changed files with 6 additions and 4 deletions
10
crunchy.ts
10
crunchy.ts
|
|
@ -1802,6 +1802,7 @@ export default class Crunchy implements ServiceClass {
|
|||
let encryptionKeysAudio;
|
||||
|
||||
if (cdm === 'widevine') {
|
||||
await this.refreshToken(true, true);
|
||||
encryptionKeysVideo = await getKeysWVD(chosenVideoSegments.pssh_wvd, api.drm_widevine, {
|
||||
Authorization: `Bearer ${this.token.access_token}`,
|
||||
'User-Agent': api.defaultUserAgent,
|
||||
|
|
@ -1813,6 +1814,7 @@ export default class Crunchy implements ServiceClass {
|
|||
});
|
||||
|
||||
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}`,
|
||||
'User-Agent': api.defaultUserAgent,
|
||||
|
|
@ -2038,10 +2040,10 @@ export default class Crunchy implements ServiceClass {
|
|||
dlFailed = true;
|
||||
} else {
|
||||
// We have the stream, so go ahead and delete the active stream
|
||||
if (playStream) {
|
||||
await this.refreshToken(true, true);
|
||||
await this.req.getData(`https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${playStream.token}`, {...{method: 'DELETE'}, ...AuthHeaders});
|
||||
}
|
||||
// if (playStream) {
|
||||
// await this.refreshToken(true, true);
|
||||
// await this.req.getData(`https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${playStream.token}`, {...{method: 'DELETE'}, ...AuthHeaders});
|
||||
// }
|
||||
|
||||
const chunkPageBody = await chunkPage.res.text();
|
||||
const chunkPlaylist = m3u8(chunkPageBody);
|
||||
|
|
|
|||
Loading…
Reference in a new issue