mirror of
https://github.com/MALSync/MAL-Sync-Backup.git
synced 2023-09-22 11:52:49 +02:00
Update index.js
This commit is contained in:
parent
2fe5ad72bd
commit
4d59d64bad
1 changed files with 6 additions and 3 deletions
9
index.js
9
index.js
|
@ -26,11 +26,14 @@ async function backup(url, name, type = 'anime', page = 0, ids = {}) {
|
|||
if(json.next) {
|
||||
return await backup(url, name, type, page + 1, ids);
|
||||
} else {
|
||||
if(type === 'anime') {
|
||||
return await backup(url, name, 'manga', 0, ids)
|
||||
}
|
||||
for(item in ids) {
|
||||
await fs.outputFile(`data/${name}/${item}/_index.json`, JSON.stringify(ids[item].sort(), null, 2))
|
||||
}
|
||||
if(type === 'anime') {
|
||||
return await backup(url, name, 'manga')
|
||||
if(name === 'pages') {
|
||||
await fs.outputFile(`data/${name}/_index.json`, JSON.stringify(Object.keys(ids).sort(), null, 2))
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -80,4 +83,4 @@ process.on('unhandledRejection', err => {
|
|||
process.exit(1);
|
||||
});
|
||||
|
||||
start();
|
||||
start();
|
||||
|
|
Loading…
Reference in a new issue