Fantasy Football (Yahoo!/ESPN) Scoring

Links to your fantasy teams on Yahoo! or ESPN and provides real time scoring changes against your opponent. Can cycle between multiple teams you have created on either site.

This would be my number 1 used app.

2 Likes

Same. Having my tidbyt near my TV watching RedZone on Sundays would be magical!

2 Likes

Figured I would add to this thread, since I mistakenly started a new fantasy sports thread. Granted, I requested fantasy sports in general, whereas this is Football specifically. Either way, this would be great to have.

Is this thread at risk of closing? Due to age.

Played around with the code a bit after referencing another ESPN FF app for slack. If someone wants to test/edit/update the code feel free. There are params that you will have to set that are unique to your league ID, etc…

// import the necessary modules
import http
import json
import graphics
import time

// set up the Tidbyt screen dimensions
screen_width = 192
screen_height = 32

// set up the API endpoint and parameters
api_endpoint = "https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022/segments/0/leagues/{LEAGUE_ID}"
api_params = {
  "view": "mTeam"
}

// make the API request
api_response = http.get(api_endpoint.format(LEAGUE_ID="your_league_id"), params=api_params)
api_data = json.loads(api_response.content)

// extract the relevant data from the API response
teams_data = api_data["teams"]
league_standings = [(team_data["location"], team_data["nickname"], team_data["record"]["overall"]["wins"], team_data["record"]["overall"]["losses"], team_data["record"]["overall"]["ties"], team_data["pointsFor"], team_data["pointsAgainst"]) for team_data in teams_data]

// sort the league standings by wins, then points for
league_standings.sort(key=lambda x: (x[2], x[5]), reverse=True)

// format the league standings for display
league_standings_text = "League standings:\n"
for i, standing in enumerate(league_standings):
    league_standings_text += str(i+1) + ". " + standing[0] + " " + standing[1] + ": " + str(standing[2]) + "-" + str(standing[3]) + "-" + str(standing[4]) + ", PF: " + str(standing[5]) + ", PA: " + str(standing[6]) + "\n"

// draw the matchup information on the screen
graphics.clear()
graphics.draw_text(x=0, y=0, text="This week's matchup:", size=12, color="#FFFFFF")

// display the matchup information for 5 seconds
graphics.show()
time.sleep(5)

// set up the API endpoint and parameters for the next screen
api_endpoint = "https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022/segments/0/leagues/{LEAGUE_ID}"
api_params = {
  "view": "mTeam"
}

// make the API request for the next screen
api_response = http.get(api_endpoint.format(LEAGUE_ID="your_league_id"), params=api_params)
api_data = json.loads(api_response.content)

// extract the relevant data from the API response for the next screen
teams_data = api_data["teams"]
division_standings = {}
for team_data in teams_data:
    division_id = team_data["divisionId"]
    if division_id not in division_standings:
        division_standings[division_id] = []
    division_standings[division_id].append((team_data["location"], team_data["nickname"], team_data["record"]["overall"]["wins"], team_data["record"]["overall"]["losses"], team_data["record"]["overall"]["ties"]))

// format the division standings for display
division_standings_text = ""
for division_id, standings in division_standings.items():
    division_standings_text += "Division " + str(division_id) + ":\n"
    for standing in standings:
        division_standings_text += "- " + standing[0] + " " + standing[1] + ": " +

1 Like

Is it challenging with the variety of fantasy apps? ESPN/Yahoo/NFL

@Pajji I have my league renewed and it’s successfully connected, but it says “check your league number”. My league is 12 years old. Is there a minimum amount of digits i need for my tidbyt to run the app correctly?

I think you have to set your league to a public league to let 3rd party apps work. Try that?

Hey all - I created the Yahoo Fantasy Football and Baseball apps. I just pushed an update to the Football one that I’m awaiting approval on which simplifies things a bit. Take a look and let me know if there is anything you think is missing.

-Jay

2 Likes

Where can I put this code to test it? I can figure out all the areas that says (input league is) I just dont know where to test this code.

Any chance you could create one for fantasy football based off of sleeper?

I could probably do that. Do you just have a “normal” sleeper league?

Yes, we just run a keeper league on sleeper. Very similar to yahoo given you have the option to run “redraft” or “keeper” leagues.

Ok cool - I’m working on it. I think it’s almost done. Usually takes a week or two to get it approved by TidByt once I submit it.

-Jay

2 Likes

I tried making my league public, but it still doesn’t work. Any update on this? It would be such a brag to my friends if it were to work.

@AVB78 - Hey - Are you referring to the Yahoo Fantasy NFL app? If so, I wrote it so I may be able to help you out. First thing I’d try is to delete it and re-install because I made some changes a week or two ago that don’t require you to enter League ID. If you try this and it still doesn’t work send me a message on Tidbyt Discord @jweier or on here if you’re not on Discord.

-Jay

Hey Jay,

Can you make a tidbyt app for ESPN fantasy football?

Just to bump- does anyone know of an ESPN FF app or able to create one? Would honestly get another Tidbyt just to have multiple league scores live-streamed next to RedZone on Sundays. Truly a dream come true.

2 Likes