Created
June 14, 2022 21:25
-
-
Save teidesu/d380c28650420f3212905840532da969 to your computer and use it in GitHub Desktop.
idk why i made this. this checks ege (use) results via mos.ru
This file contains 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
const _got = require('got') | |
const cheerio = require('cheerio') | |
// cookie хедер с mos.ru | |
const COOKIE = '' | |
// код регистрации | |
const REG_CODE = '1234-5678-9012' | |
// номер документа без серии | |
const DOC_NUM = '123456' | |
const got = _got.extend({ | |
headers: { | |
origin: 'https://www.mos.ru', | |
referer: 'https://www.mos.ru/pgu/ru/application/dogm/040201/', | |
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.41', | |
cookie: COOKIE | |
} | |
}) | |
async function main() { | |
const page = await got.get('https://www.mos.ru/pgu/ru/application/dogm/040201/').text() | |
const uniqueFormHash = cheerio.load(page)('input[name=uniqueFormHash]').attr('value') | |
const a = await got.post('https://www.mos.ru/pgu/ru/application/dogm/040201/', { | |
headers: { | |
'x-requested-with': 'XMLHttpRequest' | |
}, | |
form: { | |
send_from_step: 1, | |
total: 2, | |
org_id: 'dogm', | |
form_id: '040201', | |
action: 'send', | |
uniqueFormHash, | |
'field[new_sh2_person2_login1]': REG_CODE, | |
'field[new_sh2_person2_password1]': DOC_NUM, | |
comment: '', | |
} | |
}).json() | |
const data = await got.post('https://www.mos.ru/pgu/ru/application/dogm/040201/', { | |
headers: { | |
'x-requested-with': 'XMLHttpRequest' | |
}, | |
form: { | |
ajaxModule: 'Ege', | |
ajaxAction: 'give_data', | |
ajax_app_id: a.app_id | |
} | |
}).json() | |
console.log(data.data.status_info.status_title) | |
let result = data.data.CoordinateStatusDataMessage.Documents.ServiceDocument.CustomAttributes.examResultList.examResult | |
if (!Array.isArray(result)) result = [result] | |
for (const it of result) { | |
const prescore = it.resultPart.find(i => i.name === 'prescore') | |
const score = it.resultPart.find(i => i.name === 'score') | |
let str = `${it.type} ${it.subjectName} (${it.date}) -- ` | |
if (prescore?.value) { | |
str += `${prescore.value} тестовых, ${score.value} итог` | |
} else { | |
str += score.value | |
} | |
console.log(str) | |
} | |
} | |
main().catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment