[CR] Implement deleting streams
Allows endless non-drm downloads
This commit is contained in:
parent
dbc2c7d52b
commit
fc0736c686
2 changed files with 17 additions and 13 deletions
28
crunchy.ts
28
crunchy.ts
|
|
@ -1414,21 +1414,22 @@ export default class Crunchy implements ServiceClass {
|
|||
pbData = await playbackReq.res.json() as PlaybackData;
|
||||
}
|
||||
|
||||
let switchStream: CrunchyPlayStream | null = null;
|
||||
const playbackReq = await this.req.getData(`https://cr-play-service.prd.crunchyrollsvc.com/v1/${currentVersion ? currentVersion.guid : currentMediaId}/console/switch/play`, AuthHeaders);
|
||||
if(!playbackReq.ok || !playbackReq.res){
|
||||
if(!playbackReq.ok || !playbackReq.res) {
|
||||
console.error('Non-DRM Request Stream URLs FAILED!');
|
||||
} else {
|
||||
const playStream = await playbackReq.res.json() as CrunchyPlayStream;
|
||||
switchStream = await playbackReq.res.json() as CrunchyPlayStream;
|
||||
const derivedPlaystreams = {} as CrunchyStreams;
|
||||
for (const hardsub in playStream.hardSubs) {
|
||||
const stream = playStream.hardSubs[hardsub];
|
||||
for (const hardsub in switchStream.hardSubs) {
|
||||
const stream = switchStream.hardSubs[hardsub];
|
||||
derivedPlaystreams[hardsub] = {
|
||||
url: stream.url,
|
||||
'hardsub_locale': stream.hlang
|
||||
};
|
||||
}
|
||||
derivedPlaystreams[''] = {
|
||||
url: playStream.url,
|
||||
url: switchStream.url,
|
||||
hardsub_locale: ''
|
||||
};
|
||||
pbData.data[0]['adaptive_switch_dash'] = {
|
||||
|
|
@ -1460,7 +1461,7 @@ export default class Crunchy implements ServiceClass {
|
|||
console.warn('Decryption not enabled!');
|
||||
}
|
||||
|
||||
for(const s of Object.keys(pbStreams)){
|
||||
for (const s of Object.keys(pbStreams)) {
|
||||
if (
|
||||
(s.match(/hls/) || s.match(/dash/))
|
||||
&& !(s.match(/hls/) && s.match(/drm/))
|
||||
|
|
@ -1483,7 +1484,7 @@ export default class Crunchy implements ServiceClass {
|
|||
}
|
||||
}
|
||||
|
||||
if(streams.length < 1){
|
||||
if (streams.length < 1) {
|
||||
console.warn('No full streams found!');
|
||||
return undefined;
|
||||
}
|
||||
|
|
@ -1522,8 +1523,7 @@ export default class Crunchy implements ServiceClass {
|
|||
}
|
||||
dlFailed = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
streams = streams.filter((s) => {
|
||||
if(s.hardsub_lang != '-'){
|
||||
return false;
|
||||
|
|
@ -1543,7 +1543,7 @@ export default class Crunchy implements ServiceClass {
|
|||
let curStream:
|
||||
undefined|typeof streams[0]
|
||||
= undefined;
|
||||
if(!dlFailed){
|
||||
if (!dlFailed) {
|
||||
options.kstream = typeof options.kstream == 'number' ? options.kstream : 1;
|
||||
options.kstream = options.kstream > streams.length ? 1 : options.kstream;
|
||||
|
||||
|
|
@ -2127,10 +2127,14 @@ export default class Crunchy implements ServiceClass {
|
|||
else{
|
||||
console.warn('Can\'t find urls for subtitles!');
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else{
|
||||
console.info('Subtitles downloading skipped!');
|
||||
}
|
||||
|
||||
if (switchStream) {
|
||||
await this.req.getData(`https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${switchStream.token}`, {...{method: 'DELETE'}, ...AuthHeaders});
|
||||
}
|
||||
|
||||
await this.sleep(options.waittime);
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "multi-downloader-nx",
|
||||
"short_name": "aniDL",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.2",
|
||||
"description": "Downloader for Crunchyroll, Hidive, AnimeOnegai, and AnimationDigitalNetwork with CLI and GUI",
|
||||
"keywords": [
|
||||
"download",
|
||||
|
|
|
|||
Loading…
Reference in a new issue