Skip to content

Instantly share code, notes, and snippets.

@moomdate
Last active May 9, 2020 11:17
Show Gist options
  • Select an option

  • Save moomdate/fb343f54c63d8beb2e65aeb28c565fa3 to your computer and use it in GitHub Desktop.

Select an option

Save moomdate/fb343f54c63d8beb2e65aeb28c565fa3 to your computer and use it in GitHub Desktop.
var header = Array();
var jsonData = {};
var temp_courseId,temp_coureCode,temp_courseName;
var courseObject = [];
$("html body table tbody tr td table tbody tr td font").each(function (i, v) {
if ($(this).attr("size") == "2") {
let data = $(this).first().context.textContent;
if (data.length < 15) {
let url = $(this).context.innerHTML
let arrObj = url.split("&amp;");
if(arrObj[2] == undefined ){
console.log(arrObj)
}
let courseId = arrObj[2] ==undefined ? 'err': arrObj[2].split("=")[1]
let courseCode =arrObj[3] ==undefined ? 'err': arrObj[3].split("=")[1]
temp_courseId = courseId;
temp_coureCode = courseCode;
//console.log(courseId,courseCode)
}
if(typeof $(this).first().context.firstChild.data === "string")
{
let courseName = $(this).first().context.firstChild.data;
let courseO = {
courseId:temp_courseId,
courseCode:temp_coureCode,
courseName:courseName
}
let see = courseObject.find(data=>data.courseCode==temp_courseId);
if(courseName.length>2 &&!see){
courseObject.push(courseO);
temp_courseId = undefined;
temp_coureCode = undefined;
}
}
}
})
courseObject = courseObject.filter(data=>data.courseId!='err')
console.log(courseObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment