Skip to content

Instantly share code, notes, and snippets.

@ntkog
Last active November 25, 2018 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntkog/6340fb153e3d3d65e1a628a1bd657dd2 to your computer and use it in GitHub Desktop.
Save ntkog/6340fb153e3d3d65e1a628a1bd657dd2 to your computer and use it in GitHub Desktop.
Estadísticas Instántaneas de la Agenda de la Commit Conf 2018
function getData(day) {
return [...document.querySelectorAll('span.button-label + span.button-indicator,.agenda-talk-title, a.agenda-social-link[title*="votes"]')].reduce((o,c,i,a)=>{
if (i % 3 == 0) {
o.push({
day: day,
title: a[i].textContent,
bookmarked: +a[i + 1].textContent,
votes: +a[i + 2].title.split(" out of ")[1].split(" votes")[0],
rating: +a[i + 2].title.split(" out of ")[0],
ratio: +a[i + 2].title.split(" out of ")[1].split(" votes")[0] * 100 / +a[i + 1].textContent
})
};
return o;
}
, []);
};
let dia23 = getData(23);
document.querySelector('.menu-item[aria-current="false"]').click();
let dia24 = getData(24);
console.table(dia23.concat(dia24));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment