Skip to content

Instantly share code, notes, and snippets.

@asmalcev
Created July 21, 2023 20:20
Show Gist options
  • Save asmalcev/4b3482c908d70f4d4a2538e2338209da to your computer and use it in GitHub Desktop.
Save asmalcev/4b3482c908d70f4d4a2538e2338209da to your computer and use it in GitHub Desktop.
Script to download entrants table from abit.itmo.ru
{
const a = document.createElement("a");
a.href = URL.createObjectURL(
new Blob(
[
JSON.stringify(
Array.from(document.querySelectorAll("*"))
.filter((el) => /RatingPage_table__item__/.test(el.className))
.map((el) => {
const res = {};
const item = Array.from(el.querySelectorAll("*")).filter((ch) =>
/RatingPage_table/.test(ch.className)
);
const possnils = item[1].innerText.split(" ");
res.position = possnils[0];
res.snils = possnils[1].slice(1);
const prch = item[4].innerText.replace(/\s+/g, " ").split(" ");
res.priority = prch[1];
res.challenge = prch.slice(4).join(" ");
const points = item[5].innerText
.split("\n\n")
.map((l) => l.split(":")[1].trim());
res.achievements = points[0];
res.challangePoints = points[1];
res.sumPoints = points[2];
res.average = points[3].slice(1);
res.originalDocs = points[4];
return res;
})
),
],
{ type: "application/json" }
)
);
a.download = "data.json";
a.click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment