Last active
January 24, 2018 06:16
-
-
Save akrolsmir/dc8d969ce6eeabb3f60e0747c67165af to your computer and use it in GitHub Desktop.
Import your manga from Batoto to Mangadex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Instructions: | |
1) Go to https://mangadex.com on Chrome. | |
2) Open the Chrome console (Ctrl+Shift+J on Windows). | |
3) Copy + paste the code in this file. | |
4) Replace batoto_ids in line 10 with a list of the manga to follow. | |
5) Hit Enter. | |
*/ | |
var batoto_ids = [1, 2, 3, 5, 8] // TODO: REPLACE WITH YOUR OWN MANGA | |
var successes = [], failures = []; | |
function follow_manga(index) { | |
// Follow this manga by making an AJAX call. | |
var id = batoto_ids[index]; | |
$.ajax({ | |
url: `/ajax/actions.ajax.php?function=manga_follow&id=${id}`, | |
type: "GET", | |
success: () => {successes.push(id)}, | |
error: () => {failures.push(id)}, | |
}) | |
.then(() => { | |
console.log(`Processed #${index + 1}: ${id}.`); | |
// Wait 300ms, then follow the next manga in the list. | |
index++; | |
if (0 < index && index < batoto_ids.length) { | |
setTimeout(() => {follow_manga(index)}, 300); | |
} else { | |
// Finished processing all manga. | |
console.log(`Followed ${successes}. Could not follow ${failures}.`); | |
} | |
}); | |
} | |
follow_manga(0); |
Saved me a lot of time too! Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muchisimas gracias me ahorraste un buen de trabajo