Skip to content

Commit

Permalink
Merge pull request #95 from amarvin/91-update-for-2024
Browse files Browse the repository at this point in the history
Fixes IDP league that had public settings but private players
  • Loading branch information
amarvin authored Aug 16, 2024
2 parents 04f3f94 + 99fd4c8 commit 6ba96a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ffbot/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# A public league for current week and player IDs
PUBLIC_LEAGUE = 101
PUBLIC_LEAGUE_IDP = 408
PUBLIC_LEAGUE_IDP = 413
SEARCH_PLAYER_GROUPS = ["QB", "WR", "RB", "TE", "K", "DEF"]
SEARCH_PLAYER_GROUPS_IDP = ["QB", "WR", "RB", "TE", "K", "D", "DB", "DL", "LB"]

Expand Down
15 changes: 15 additions & 0 deletions find_public_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@
found_public = True
print(f"{public_league} is a valid public league")
elif "DB" in positions:
# Confirm players list is accessible
url = "https://football.fantasysports.yahoo.com/f1/{}/players".format(
public_league
)
s.headers["User-Agent"] = generate_user_agent()
r = s.get(url)
try:
dfs = read_html(StringIO(r.text))
except ValueError as e:
if str(e) == "No tables found":
print(f"{public_league} is not a valid public IDP league")
sleep(10)
continue
else:
raise e
found_public_idp = True
print(f"{public_league} is a valid public IDP league")

Expand Down

0 comments on commit 6ba96a6

Please sign in to comment.