Last active
May 6, 2025 20:25
-
-
Save col3name/53d300a8bc6ccc62f050b2ce429fa0d9 to your computer and use it in GitHub Desktop.
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 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