thisiscam / calcentral-schedule-to-ical

7 stars 6 forks source link

Update code for current Calcentral #6

Open clayshieh opened 7 years ago

clayshieh commented 7 years ago

I've fixed calnet_login() to handle cookies and get the secret field but I cant figure out what get_userdata() was supposed to return. Could you provide an example or gist of what the data was supposed to be?

thisiscam commented 7 years ago

I have graduated and no longer have access to the schedule page.. But get user data was a hack that tried to match a json(which contains all your enrolled classes) that was encoded n the returned html. I'm not sure if they changed this behavior, but looking for json string on that page might help.

thisiscam commented 7 years ago

@clayshieh It might be useful if you can PR to fix the calnet_login function first --- I think I might have a chance at fixing this entirely as

  1. I figured that I still have access to the schedule planner
  2. I noticed they are still hard coding the json string in the html 👍

But if you want to investigate this on your own: It's very likely that the the URL "https://calcentral.berkeley.edu/college_scheduler/student/UGRD/2168" is no longer accurate: When I go to this address, I'm prompted with a choice between either Summer or Fall schedule; and clicking on "Fall" for example, landed me onto "https://berkeley.collegescheduler.com/terms/2017%20Fall/options" <--- if you inspect the page source, it should contain a huge JSON in one of the script tag for your schedule :)


Lastly, you might want to check the chrome extension. It still seems to be working, but please let me know if otherwise

clayshieh commented 7 years ago

@thisiscam yeah I got that far as well but I wasn't familiar with the iCalendar library so I wanted to see how to transform the data to just feed into your existing code rather than rewriting the code that handles the iCalendar creation. I'll look into it when I have time though!

thisiscam commented 6 years ago

Could you please fork and push your current modifications? I can take it from there

clayshieh commented 6 years ago

@thisiscam hi so I rewrote calnet_login() to parse the token from the hidden field in the token and I also rewrote get_userdata() to parse the schedule data from the calcentral api endpoint https://calcentral.berkeley.edu/api/my/academics by prompting the user to select which semester they would like to generate the ics calendar for as the endpoint provides information about all semesters taken. Currently the data returned from the new get_userdata() does not work with the make_calendar() function but it should be all the information that it needs. Please let me know! Fork here: https://github.com/clayshieh/calcentral-schedule-to-ical

thisiscam commented 5 years ago

@clayshieh Your fix seems promising (for the python version, at the very least). I think the missing parts are: 1) not knowing the start and end dates of recurrence 2) figure out a way to parse "MWF 1:30P-3:30P" 2) should be just engineering problem, but 1) I don't know how to fix because I don't have full access and don't know how Calcentral work these days.

Also see #8

clayshieh commented 5 years ago

hi @thisiscam unfortunately you and I are in the same boat as I graduated about two years ago as well and no longer have access to Calcentral but I'll update this PR if I can find someone can let me use their calnet but I remember seeing other sites posted on the Berkeley Facebook groups that generates the ical via a manual method but not automatically, maybe this repo would be of interest to them.