CalvinWu4 / RIT-Rate-My-Professors-Extension

Chrome/Firefox extension that shows the Rate My Professors rating of professors while searching for classes on Tiger Center
The Unlicense
4 stars 2 forks source link

RateMyProfessors now seems to use a graphql API #2

Closed MoralCode closed 1 year ago

MoralCode commented 1 year ago

Screenshot_20230620_164635 Screenshot_20230620_164856

Seems like the extension currently is trying to use an old, now-deprecated REST API

this seems to be a sample of a new endpoint that might be a replacement for the one currently in use:

curl 'https://www.ratemyprofessors.com/graphql' -X POST -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://www.ratemyprofessors.com/professor/568275' -H 'Content-Type: application/json' -H 'Authorization: Basic dGVzdDp0ZXN0' -H 'Origin: https://www.ratemyprofessors.com' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Cookie: ccpa-notice-viewed-02=true; cid=-VEdhkoW5x-20230620; userSchoolId=U2Nob29sLTgwNw==; userSchoolLegacyId=807; userSchoolName=Rochester%20Institute%20of%20Technology' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-GPC: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data-raw '{"query":"query NewSearchTeachersQuery(\n  $query: TeacherSearchQuery!\n) {\n  newSearch {\n    teachers(query: $query) {\n      didFallback\n      edges {\n        cursor\n        node {\n          id\n          legacyId\n          firstName\n          lastName\n          school {\n            name\n            id\n          }\n          department\n        }\n      }\n    }\n  }\n}\n","variables":{"query":{"text":"aaron deever","schoolID":"U2Nob29sLTgwNw=="}}}'
MoralCode commented 1 year ago

their schema graphql-erd

as obtained by putting the results of this query https://stackoverflow.com/a/46543255 into here : http://nathanrandal.com/graphql-visualizer/

MoralCode commented 1 year ago

Currently working on this in my fork on the graphql branch

Seems like the generated html is pretty tightly integrated with the responses from the API so its gonna be tricky/time consuming to swap the API out without breaking a ton of things

Having some instructions for how this was built and run might also help, currently running into an issue where importScript is not found

CalvinWu4 commented 1 year ago

Wow thanks so much!

MoralCode commented 1 year ago

weather update: it now kind of works

i pretty much just started over and bypassed a lot of the recursive name-trying logic cuz it looked complicated - so maybe thats why some of the names arent showing up

Screenshot_20230621_194422 Screenshot_20230621_194416

MoralCode commented 1 year ago

jk it wasn't working because it was crashing.

Screenshot_20230621_195151

hover tooltips are uuh a lil broken tho

MoralCode commented 1 year ago

I suspect something in the tooltip library got updated and broke things.

Might try either downgrading tippy, messing with it until it works, or moving all the dom manipulation code into a html template to better see what the structure of that tooltip looks like

Guess this means I'm now live-tweeting updates on the nerdiest of Twitter alternatives haha

MoralCode commented 1 year ago

Screenshot_20230622_114912

just a small CSS import/linking issue - of course