shaurya98's blog

By shaurya98, history, 8 years ago, In English

Hello Community, In all contests that I have given on Codeforces, I realized that much of my time was wasted in repeatedly checking if the ratings have been updated.Also while going through the APIs that Codeforces provides, I came across the one that fetches the rating changes of a specific contest.And so I came up with this https://gist.github.com/shaurya31/44ccca5736ca9ff1d0f537343723719f.

This python script asks for user's handle and url of the main page of the contest (for which the user is waiting for rating changes).The script then calls the Codeforces API (endpoint :- contest.ratingChanges) in regular intervals of time and as soon as the ratings are updated, the API gives the rankings to the script which will then inform you your rating changes in form of an automatically generated message box.

Rating changes could also have been tracked by tracking changes in html of user's profile page and keeping track when the value of the tag which stores rating changes (using BeautifulSoup). But it will not help if the present contest changes user's ratings by 0 and also my study about scraping data suggests that it is not that reliable as tag id used to store the ratings may change on change to HTML structure of the page and so scraping data from HTML should be used if there is no API to fetch the required data.Codeforces has done a commendable job in maintaining all those wonderful APIs which makes a developer jobs pretty easy.I recommend all of you to have a look at them.

Any changes/ideas are most welcome. Enjoy and Happy Coding!!

UPDATE : Forgot to mention one thing.Execute the script once the system testing ends.

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it