Skip to content

Commit

Permalink
corrected team names in urls
Browse files Browse the repository at this point in the history
  • Loading branch information
agentmorris committed Jan 4, 2024
1 parent e478805 commit 46d6edf
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions nfl-game-dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pickle
import copy

from collections import defaultdict
from tqdm import tqdm
from dateutil import parser as dateparser
from datetime import timedelta
Expand All @@ -34,7 +35,7 @@

# Will sleep this many seconds after every request for either a whole page or an
# individual box score.
sleep_after_request_time = 1.0
sleep_after_request_time = 3.0


#%% Classes
Expand Down Expand Up @@ -472,7 +473,7 @@ def team_name_from_team_string(team_string):
def game_list_to_html(games,week,year,output_format='html',
include_quality_info=False,
team_records=None,
include_gamepass_links=False):
include_gamepass_links=True):
"""
Given a list of games (created by load_game_times()), generate the nice HTML content
we did all this work for.
Expand Down Expand Up @@ -567,9 +568,9 @@ def game_list_to_html(games,week,year,output_format='html',

previous_game_time = game.start_time

# E.g. New Orleans Saints at Green Bay Packers
visiting_team = game.team_away
home_team = game.team_home
# Turn "New Orleans Saints" into "saints"
visiting_team = team_name_from_team_string(game.team_away).lower()
home_team = team_name_from_team_string(game.team_home).lower()

assert gamepass_base_url.endswith('/')
gamepass_url = gamepass_base_url + visiting_team + '-at-' + home_team + '-' + \
Expand Down Expand Up @@ -627,9 +628,6 @@ def back_up_game_data(year_to_games):
min_year = 2009
max_year = 2022

from collections import defaultdict
from tqdm import tqdm

year_to_games = defaultdict(list)

if initial_sleep_time > 0:
Expand Down Expand Up @@ -965,8 +963,8 @@ def back_up_game_data(year_to_games):

#%%

year = 2022
week = 12
year = 2023
week = 18
games = load_game_times(year,week)
for s in games:
print(s)
Expand Down

0 comments on commit 46d6edf

Please sign in to comment.