Closed cdleong closed 5 years ago
I'm thinking, let's connect to Yahoo and get live data?
Actually, here's something: https://github.com/thorrr/YahooSports
<?xml version="1.0" ?><fantasy_content copyright="Data provided by Yahoo! and STATS, LLC" ns0:uri="http://fantasysports.yahooapis.com/fantasy/v2/game/nfl" refresh_rate="60" time="31.161069869995ms" xml:lang="en-US" xmlns:ns0="http://www.yahooapis.com/v1/base.rng">
<game>
<game_key>380</game_key>
<game_id>380</game_id>
<name>Football</name>
<code>nfl</code>
<type>full</type>
<url>https://football.fantasysports.yahoo.com/f1</url>
<season>2018</season>
<is_registration_over>0</is_registration_over>
<is_game_over>0</is_game_over>
<is_offseason>0</is_offseason>
</game>
</fantasy_content>
Managed to get data using https://github.com/thorrr/YahooSports
Can I get league data if I have the league ID?
Answer was yes.
Also, here's the main query for getting player data:
query = "game/nfl/players;out=draft_analysis,percent_owned" # get all the players, with percent_owned
But that only retrieves 25 results.
It essentially gives you the same things as going on https://football.fantasysports.yahoo.com/ and looking at the player list.
https://football.fantasysports.yahoo.com/f1/draftanalysis for example.
You can modify it by filters like this:
query = "game/nfl/players;out=draft_analysis,percent_owned;position=" + position + ";count=" + str(count) + ";start=" + str(start)
So I setup a loop to repeatedly query Yahoo until it starts giving me results
Now to transform it into a form that I can work with programmatically.
Two-part problem here:
Optional:
My general go-to is to check https://github.com/vinta/awesome-python or https://docs.python-guide.org/
ooh, the "untangle" library looks good: https://github.com/stchris/untangle alternatively, xmltodict or xmldataset could be good.
The other part of the problem I haven't mentioned, is that I actually don't have one XML string, I have maybe a dozen.
OK, decision to make. How do I want to handle the data? Make a Player object, or leave it in, like, a big table?
As a first initial goal, I think having one big dictionary or JSON with all 2789 entries would be a good place to start.
So today we've got it into a big list at least. Next step, sorting based on fields like ADP or whatever