Skip to content

Instantly share code, notes, and snippets.

@PxyUp
Created February 5, 2019 15:19
Show Gist options
  • Save PxyUp/d93860c77cad8b281e4bf7a452109372 to your computer and use it in GitHub Desktop.
Save PxyUp/d93860c77cad8b281e4bf7a452109372 to your computer and use it in GitHub Desktop.
GetResults
let getResult = () => {
const hashMap = {}
document.querySelectorAll(".list-group-contest-item").forEach((item) => {
const auth = item.querySelector(".has-candidate .contest-item-candidate > a");
if (auth) {
const url = auth.href
hashMap[auth.textContent] = hashMap[auth.textContent] ? [hashMap[auth.textContent][0], hashMap[auth.textContent][1] + 1] : [auth.textContent, 1]
}
});
return Object.keys(hashMap).map((e) => hashMap[e]).sort((e, e2) => e2[1] - e[1])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment