uf_api
uf_api copied to clipboard
Way to gather all possible courses in fall 2018
Here is some shit code I wrote, figured maybe somebody might find it useful. If you want the JSON that is generated from this lmk
var self =this;
console.log("Made " + x + " request");
var url = "https://one.uf.edu/apix/soc/schedule/?category=CWSP&term=2188&last-control-number=" + x;
request(url, function(error, response, html) {
if (!error) {
var temp = JSON.parse(html);
for(var i =0; i<temp[0].COURSES.length; i++){
self.courses.push(temp[0].COURSES[i].code);
console.log(temp[0].COURSES[i].code);
}
if(x+50>10832){
fs.writeFile("/public/json/allPossibleCourses.json", JSON.stringify(self.courses), 'utf8', function (err) {
if (err) {
return console.log(err);
}
console.log("The file was saved!");
});
}
else{
self.recourse(x+50, res);
}
}
});
}
generatePossibleCourses(res){
var x =0;
this.courses = [];
this.recourse(x, res);
}
//Remove Duplicates
var temp={};
var output =[];
for(var i =0; i< data.length; i++){
if(!temp[data[i]]){
output.push({"title" : data[i]});
temp[data[i]]=true;
}
}
Is this just a piece of code storing the various course codes?
Ye