From ef934827e2564fd04fc206ef1e4d814d4a52785d Mon Sep 17 00:00:00 2001 From: Peter Bui Date: Thu, 29 Aug 2024 21:10:03 -0400 Subject: [PATCH] sports: update URL, not all teams have links, initialize games --- src/bobbit/modules/sports.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bobbit/modules/sports.py b/src/bobbit/modules/sports.py index 14a2734..2857811 100644 --- a/src/bobbit/modules/sports.py +++ b/src/bobbit/modules/sports.py @@ -21,9 +21,9 @@ # Constants -URL_TEMPLATE = 'http://www.cbssports.com/{sport}/scoreboard' +URL_TEMPLATE = 'https://www.cbssports.com/{sport}/scoreboard/' GAME_RX = r'
([^<]+).*?"total">([0-9]+)' +TEAM_RX = r'class="team-name-link">([^<]+)([0-9]+)' STATUS_RX = r'
]*>([^<]+)
' SPORTS_ALIAS = { 'cfb': 'college-football', @@ -74,6 +74,7 @@ def format_game(game): async def command(bot, message, sport, team=None): sport = SPORTS_ALIAS.get(sport, sport) url = URL_TEMPLATE.format(sport=sport) + games = [] async with bot.http_client.get(url) as result: try: