Update index.js

This commit is contained in:
Henrik 2021-06-15 17:29:58 +02:00 committed by GitHub
parent 2fe5ad72bd
commit 4d59d64bad

View file

@ -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();