ripgarpr / garpr

the revival of GarPR. may gar rest in RIP
17 stars 14 forks source link

Make SmashGG scraper grab all phase_groups for large tournaments. #68

Closed jschnei closed 8 years ago

jschnei commented 8 years ago

Currently, for large tournaments with multiple pools/rounds, admins have to insert every round separately (which is tedious and leads to input errors, etc.).

The SmashGG scraper can grab all the phase_group ids for a tournament via the api.smashgg.com/event API endpoint. In particular,

https://api.smashgg.com/event/{event_id}?expand[0]=entrants&expand[1]=groups

will list all the entrants and phase_groups in the event with event ID {event_id}. The event_id is the first of the three numbers; e.g. one pool for CEO has URL https://smash.gg/tournament/ceo-2016/brackets/11787/45262/150428; the event id is 11787 (the phase_group id for that specific pool is 150428). Once we have the phase_group ids, we can use the old API route to gather all the matches (i.e. https://api.smash.gg/phase_group/150428).

PS: We should also ask the SmashGG people if there is a way to grab the tournament name from some API endpoint; it is possible to grab the event name from the above API route, but unfortunately this is usually something like "Melee Singles" as opposed to "CEO 2016".

@BrandonCookeDev @VestboyMyst

BrandonCookeDev commented 8 years ago

I'm on top of it

BrandonCookeDev commented 8 years ago

Alright, I have a method of attack: I've added a property to the object called Pools. A method get_pools will populate this array with SmashGGScraper objects. From there, if pools is greater than 1, we can call the get_matches function from SmashGGScraper for that pool.

BrandonCookeDev commented 8 years ago

@jhertz @jschnei PR #69 is up. Should resolve this.

jschnei commented 8 years ago

Should be resolved by #72 .