Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// this script is meant to be pasted into a MyAnimeList Anime page console
// it will accumulate the total number of recommendations for each recommendation
// it will copy this to clipboard to be pasted into another page
// then paste the script again to accumulate that page's recommendations
// and so on...
if (typeof totals === 'undefined') totals = {}
Array.from(document.querySelectorAll('.fs10'))
.map(i=>i.parentNode)
.map(e => {
return {
title: e.querySelector('.fs10').textContent,
users: parseInt(e.querySelector('.users').textContent.split(' ')[0], 10)
}
})
.reduce((p,c) => {
p[c.title] = (p[c.title] || 0) + c.users
return p
}, totals)
console.log(totals)
copy('totals = '+JSON.stringify(totals))
Object.keys(totals).map(k => { return { users: totals[k], title: k } }).sort((a,b) => b.users-a.users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.