Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to gather all possible courses in fall 2018 #5

Open
Luc-Olsthoorn opened this issue Mar 13, 2018 · 2 comments
Open

Way to gather all possible courses in fall 2018 #5

Luc-Olsthoorn opened this issue Mar 13, 2018 · 2 comments

Comments

@Luc-Olsthoorn
Copy link

Luc-Olsthoorn commented Mar 13, 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;
						}
					}
@Rolstenhouse
Copy link
Owner

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

@Luc-Olsthoorn
Copy link
Author

Ye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants