Created
February 5, 2019 15:19
-
-
Save PxyUp/d93860c77cad8b281e4bf7a452109372 to your computer and use it in GitHub Desktop.
GetResults
This file contains hidden or 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
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