barca-reddit / MOTM

4 stars 1 forks source link

Get player rating from strawpoll API #1

Open RupGautam opened 6 years ago

RupGautam commented 6 years ago

I don't know if you being manually extracting poll data in rating.json file, but this could be a good way to pull the realtime data ? https://www.strawpoll.me/api/v2/polls/{matchid} E.g: https://www.strawpoll.me/api/v2/polls/13896692

barca-reddit commented 6 years ago

Thanks a lot for the idea. I am already using the strawpoll API "behind the scenes" before the ratings.json object is exported and pushed to github.

The problem with that would be that each time someone visits the page, they will have to make more than 30 API requests (the amount of games played, the list keeps growing), and I'm not sure that's a great idea.

It might also make the site slow so at least for now I prefer to do all the calculations on my end beforehand, I have NodeJS scripts and a SQLite database for all of that.

Also, their API went down a few weeks ago so if it happens again that would render this website kinda useless.

If you think I'm missing something obvious than let me know, but at least for now I don't see this as very practical.