From 5c11d942c110d08a00671ca970ea18253217c5e7 Mon Sep 17 00:00:00 2001 From: AnimeDL Date: Sat, 2 Aug 2025 10:14:33 -0700 Subject: [PATCH] Add --raw flag Currently only applies to --new on Crunchy --- crunchy.ts | 12 +++++++++--- modules/module.app-args.ts | 3 ++- modules/module.args.ts | 12 ++++++++++++ package.json | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/crunchy.ts b/crunchy.ts index 9e0f719..24a4457 100644 --- a/crunchy.ts +++ b/crunchy.ts @@ -113,7 +113,7 @@ export default class Crunchy implements ServiceClass { } else if(argv.new){ await this.refreshToken(); - await this.getNewlyAdded(argv.page); + await this.getNewlyAdded(argv.page, argv.raw); } else if(argv.search && argv.search.length > 2){ await this.refreshToken(); @@ -1028,7 +1028,7 @@ export default class Crunchy implements ServiceClass { } } - public async getNewlyAdded(page?: number){ + public async getNewlyAdded(page?: number, raw: boolean = false) { if(!this.token.access_token){ console.error('Authentication required!'); return; @@ -1042,7 +1042,7 @@ export default class Crunchy implements ServiceClass { }; const newlyAddedParams = new URLSearchParams({ sort_by: 'newly_added', - n: '25', + n: '50', start: (page ? (page-1)*25 : 0).toString(), }).toString(); const newlyAddedReq = await this.req.getData(`${api.browse}?${newlyAddedParams}`, newlyAddedReqOpts); @@ -1051,6 +1051,12 @@ export default class Crunchy implements ServiceClass { return; } const newlyAddedResults = await newlyAddedReq.res.json(); + + if (raw) { + console.info(JSON.stringify(newlyAddedResults, null, 2)); + return; + } + console.info('Newly added:'); for(const i of newlyAddedResults.items){ await this.logObject(i, 2); diff --git a/modules/module.app-args.ts b/modules/module.app-args.ts index b291e8f..65bd7f4 100644 --- a/modules/module.app-args.ts +++ b/modules/module.app-args.ts @@ -69,7 +69,8 @@ let argvC: { fileName: string; numbers: number; nosess: string; - debug: boolean | undefined; + debug: boolean | undefined; + raw: boolean; nocleanup: boolean; help: boolean | undefined; service: 'crunchy' | 'hidive' | 'ao' | 'adn'; diff --git a/modules/module.args.ts b/modules/module.args.ts index d25a419..3b843f4 100644 --- a/modules/module.args.ts +++ b/modules/module.args.ts @@ -831,6 +831,18 @@ const args: TAppArg[] = [ default: false } }, + { + name: 'raw', + describe: 'If true, the tool will output the raw data from the API (Where applicable, the feature is a WIP)', + docDescribe: true, + group: 'util', + service: ['all'], + type: 'boolean', + usage: '', + default: { + default: false + } + }, { name: 'force', describe: 'Set the default option for the \'alredy exists\' prompt', diff --git a/package.json b/package.json index 77a8a23..226765e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "multi-downloader-nx", "short_name": "aniDL", - "version": "5.5.1", + "version": "5.5.2", "description": "Downloader for Crunchyroll, Hidive, AnimeOnegai, and AnimationDigitalNetwork with CLI and GUI", "keywords": [ "download",