uf_api icon indicating copy to clipboard operation
uf_api copied to clipboard

Way to gather all possible courses in fall 2018

Open Luc-Olsthoorn opened this issue 7 years ago • 2 comments

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;
						}
					}

Luc-Olsthoorn avatar Mar 13 '18 16:03 Luc-Olsthoorn

Is this just a piece of code storing the various course codes?

Rolstenhouse avatar Mar 20 '18 16:03 Rolstenhouse

Ye

Luc-Olsthoorn avatar Mar 21 '18 03:03 Luc-Olsthoorn