Skip to content

Instantly share code, notes, and snippets.

@saitho
Created September 19, 2021 21:54
Show Gist options
  • Save saitho/f994203a449e7791f8fcefcb825834ec to your computer and use it in GitHub Desktop.
Save saitho/f994203a449e7791f8fcefcb825834ec to your computer and use it in GitHub Desktop.
Archive of our Own - Get Top 30 Series by count
// https://archiveofourown.org/media/Anime%20*a*%20Manga/fandoms
const series = [];
for(const a of document.querySelectorAll('.fandom .tag')) {
let m = /(.*) \((\d+)\)/.exec(a.parentNode.innerText);
if (m !== null) {
series.push({title: m[1], count: m[2]})
}
}
series.sort(function(a, b) {
return a.count - b.count;
}).reverse();
let len = 30;
//len = series.length;
let content = '';
for(let i=0; i < len; i++) {
content += i+1 + '. ' + series[i].title + ' - ' + series[i].count + '\n';
}
console.log(content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment