Skip to content

Instantly share code, notes, and snippets.

@JasonQSY
Created May 3, 2017 16:26
Show Gist options
  • Save JasonQSY/a4a5b6959a967783010540ae1c906125 to your computer and use it in GitHub Desktop.
Save JasonQSY/a4a5b6959a967783010540ae1c906125 to your computer and use it in GitHub Desktop.
// open http://coursesel.umji.sjtu.edu.cn/tpm/findAll_LessonTaskStudent.action
// and paste the code on DeveloperTools - Console
let data = JSON.parse(document.documentElement.innerText)['data'];
let elected = {};
for (let datum of data) {
let course = datum['courseName']+datum['courseShortName'];
let student = datum['studentName'];
let section = datum['lessonTaskId'];
if (course in elected) {
if (section in elected[course]) {
elected[course][section].push(student);
} else {
elected[course][section] = [student];
}
} else {
elected[course] = {};
elected[course][section] = [student];
}
}
document.write(JSON.stringify(elected, null, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment