Skip to content

Instantly share code, notes, and snippets.

@col3name
Last active May 6, 2025 20:25
Show Gist options
  • Select an option

  • Save col3name/53d300a8bc6ccc62f050b2ce429fa0d9 to your computer and use it in GitHub Desktop.

Select an option

Save col3name/53d300a8bc6ccc62f050b2ce429fa0d9 to your computer and use it in GitHub Desktop.
let getGroup = (row, index) => document.querySelector(`#company-page_cardContainerId__MSgxF > div > div.MuiBox-root.css-0 > div > div.MuiTableContainer-root.css-kg5r73 > table > tbody > tr:nth-child(${row}) > td:nth-child(${index}) p`)
const cleanSalaray = (salary) => parseInt(salary.substring(1).split(',').join(''))
let buildResult = () => {
const result = {};
const count = document.querySelector("#company-page_cardContainerId__MSgxF > div > div.MuiBox-root.css-0 > div > div.MuiTableContainer-root.css-kg5r73 > table > tbody").childElementCount || 46;
for (let i = 1; i <= count; i++) {
try {
const grade = getGroup(i, 2).innerText;
const salary = cleanSalaray(getGroup(i, 4).innerText);
if (!result[grade]) {
result[grade] = {};
result[grade]['list'] = [salary];
} else {
result[grade].list.push(salary);
}
} catch (error) {
}
}
return Object.keys(result).reduce((acc, key) => {
const item = result[key];
acc[key] = {...item};
acc[key]['perYear'] = item.list.reduce((acc, value) => {
acc += value;
return acc;
}, 0) / item.list.length;
acc[key]['perMonth'] = acc[key]['perYear'] / 12
return acc;
}, {});
}
buildResult();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment