An AI project that includes a scraper for NFL data, postgres database, and user interface. It uses a classification algorithm to predict winners.
going to try and add sample responses to urls
4 files changed, +72 -5
+1-1nfl_client/nfl_client.py
| @@ -94,7 +94,7 @@ class NFLClient(): | ||
| 94 | 94 | self.driver.get(endpoint) |
| 95 | 95 | |
| 96 | 96 | # Start capturing network traffic |
| 97 | - self.proxy.new_har(f"nfl{time.time()}", options={'captureHeaders': True, 'captureContent': False}) | |
| 97 | + self.proxy.new_har(f"nfl{time.time()}", options={'captureHeaders': True, 'captureContent': True}) | |
| 98 | 98 | |
| 99 | 99 | # Create the path for storing har data |
| 100 | 100 | try: |
+2-2nfl_client_data/openapi.yaml
| @@ -153,13 +153,13 @@ paths: | ||
| 153 | 153 | schema: |
| 154 | 154 | type: string |
| 155 | 155 | - description: The endTime parameter |
| 156 | - example: '2023-11-06T08:00:00.000Z' | |
| 156 | + example: '2023-11-07T08:00:00.000Z' | |
| 157 | 157 | in: query |
| 158 | 158 | name: endTime |
| 159 | 159 | schema: |
| 160 | 160 | type: string |
| 161 | 161 | - description: The startTime parameter |
| 162 | - example: '2023-11-04T07:00:00.000Z' | |
| 162 | + example: '2023-11-01T07:00:00.000Z' | |
| 163 | 163 | in: query |
| 164 | 164 | name: startTime |
| 165 | 165 | schema: |
+1-1nfl_client_data/urls.json
| @@ -1 +1 @@ | ||
| 1 | -{"/football/v2/games/{id}": {"query_parameters": {"withExternalIds": {"type": "boolean", "example": "true"}}, "path_parameters": {"id": {"type": "string", "example": "b07ee5cd-f053-11ed-b4a7-bab79e4492fa"}}}, "/football/v2/stats/live/game-summaries/{id}": {"query_parameters": {}, "path_parameters": {"id": {"type": "string", "example": "b07ee5cd-f053-11ed-b4a7-bab79e4492fa"}}}, "/content/v1/videos/replays": {"query_parameters": {"gameId": {"type": "string", "example": "b07ea540-f053-11ed-b4a7-bab79e4492fa"}}, "path_parameters": {}}, "/live/v1/livestreams": {"query_parameters": {"contentType": {"type": "string", "example": "AUDIO"}, "endTime": {"type": "string", "example": "2023-11-06T08:00:00.000Z"}, "startTime": {"type": "string", "example": "2023-11-04T07:00:00.000Z"}}, "path_parameters": {}}, "/content/v1/videos": {"query_parameters": {"clipType": {"type": "string", "example": "Preview"}, "season": {"type": "integer", "example": 2023}, "seasonType": {"type": "string", "example": "REG"}, "week": {"type": "integer", "example": 9}, "sort": {"type": "string", "example": "contentDate:desc"}}, "path_parameters": {}}, "/football/v2/games/season/2023/seasonType/REG/week/10": {"query_parameters": {"withExternalIds": {"type": "boolean", "example": "true"}}, "path_parameters": {}}, "/football/v2/standings": {"query_parameters": {"seasonType": {"type": "string", "example": "REG"}, "week": {"type": "integer", "example": 8}, "season": {"type": "integer", "example": 2023}, "limit": {"type": "integer", "example": 100}}, "path_parameters": {}}, "/fe-store/instances": {"query_parameters": {"query": {"type": "string", "example": "query{viewer{instances(ids:[\"48ca44cb-212e-4dfd-a277-1d40f26b0ed1\"],label:\"\"){edges{node{name,items{id,name,image{id,src,name,alt},links{id,url,name,text},summary,title,category},title,type}}}}}"}, "variables": {"type": "string", "example": "{\"FE_STORE_INSTANCE_NAMESPACE\":\"WEB.NDC\",\"FE_STORE_TYPE_NAME\":\"CardList\",\"FE_STORE_TYPE_NAMESPACE\":\"WEB\"}"}}, "path_parameters": {}}, "/play/v1/asset/L5P64hq7cI6KLFiWM_XVSA": {"query_parameters": {}, "path_parameters": {}}} | |
| 1 | +{"/football/v2/games/{id}": {"query_parameters": {"withExternalIds": {"type": "boolean", "example": "true"}}, "path_parameters": {"id": {"type": "string", "example": "b07ee5cd-f053-11ed-b4a7-bab79e4492fa"}}}, "/football/v2/stats/live/game-summaries/{id}": {"query_parameters": {}, "path_parameters": {"id": {"type": "string", "example": "b07ee5cd-f053-11ed-b4a7-bab79e4492fa"}}}, "/content/v1/videos/replays": {"query_parameters": {"gameId": {"type": "string", "example": "b07ea540-f053-11ed-b4a7-bab79e4492fa"}}, "path_parameters": {}}, "/live/v1/livestreams": {"query_parameters": {"contentType": {"type": "string", "example": "AUDIO"}, "endTime": {"type": "string", "example": "2023-11-07T08:00:00.000Z"}, "startTime": {"type": "string", "example": "2023-11-01T07:00:00.000Z"}}, "path_parameters": {}}, "/content/v1/videos": {"query_parameters": {"clipType": {"type": "string", "example": "Preview"}, "season": {"type": "integer", "example": 2023}, "seasonType": {"type": "string", "example": "REG"}, "week": {"type": "integer", "example": 9}, "sort": {"type": "string", "example": "contentDate:desc"}}, "path_parameters": {}}, "/football/v2/games/season/2023/seasonType/REG/week/10": {"query_parameters": {"withExternalIds": {"type": "boolean", "example": "true"}}, "path_parameters": {}}, "/football/v2/standings": {"query_parameters": {"seasonType": {"type": "string", "example": "REG"}, "week": {"type": "integer", "example": 8}, "season": {"type": "integer", "example": 2023}, "limit": {"type": "integer", "example": 100}}, "path_parameters": {}}, "/fe-store/instances": {"query_parameters": {"query": {"type": "string", "example": "query{viewer{instances(ids:[\"48ca44cb-212e-4dfd-a277-1d40f26b0ed1\"],label:\"\"){edges{node{name,items{id,name,image{id,src,name,alt},links{id,url,name,text},summary,title,category},title,type}}}}}"}, "variables": {"type": "string", "example": "{\"FE_STORE_INSTANCE_NAMESPACE\":\"WEB.NDC\",\"FE_STORE_TYPE_NAME\":\"CardList\",\"FE_STORE_TYPE_NAMESPACE\":\"WEB\"}"}}, "path_parameters": {}}, "/play/v1/asset/L5P64hq7cI6KLFiWM_XVSA": {"query_parameters": {}, "path_parameters": {}}} |
+68-1notes.ipynb
| @@ -282,7 +282,7 @@ | ||
| 282 | 282 | }, |
| 283 | 283 | { |
| 284 | 284 | "cell_type": "code", |
| 285 | - "execution_count": null, | |
| 285 | + "execution_count": 1, | |
| 286 | 286 | "metadata": {}, |
| 287 | 287 | "outputs": [], |
| 288 | 288 | "source": [ |
| @@ -291,6 +291,73 @@ | ||
| 291 | 291 | "client.download_endpoints()" |
| 292 | 292 | ] |
| 293 | 293 | }, |
| 294 | + { | |
| 295 | + "cell_type": "code", | |
| 296 | + "execution_count": 8, | |
| 297 | + "metadata": {}, | |
| 298 | + "outputs": [ | |
| 299 | + { | |
| 300 | + "data": { | |
| 301 | + "text/plain": [ | |
| 302 | + "{'id': 'b07eaa67-f053-11ed-b4a7-bab79e4492fa',\n", | |
| 303 | + " 'homeTeam': {'id': '10402310-a47e-10ea-7442-16b633633637',\n", | |
| 304 | + " 'currentLogo': 'https://static.www.nfl.com/{formatInstructions}/league/api/clubs/logos/KC',\n", | |
| 305 | + " 'fullName': 'Kansas City Chiefs'},\n", | |
| 306 | + " 'awayTeam': {'id': '10402700-1662-d8ad-f45c-0b0ea460d045',\n", | |
| 307 | + " 'currentLogo': 'https://static.www.nfl.com/{formatInstructions}/league/api/clubs/logos/MIA',\n", | |
| 308 | + " 'fullName': 'Miami Dolphins'},\n", | |
| 309 | + " 'category': None,\n", | |
| 310 | + " 'date': '2023-11-05',\n", | |
| 311 | + " 'time': '2023-11-05T14:30:00Z',\n", | |
| 312 | + " 'broadcastInfo': {'homeNetworkChannels': ['NFL NETWORK'],\n", | |
| 313 | + " 'awayNetworkChannels': ['NFL NETWORK'],\n", | |
| 314 | + " 'internationalWatchOptions': [{'countryCode': 'CA',\n", | |
| 315 | + " 'broadcasters': ['DAZN Canada', 'RDS', 'TSN']},\n", | |
| 316 | + " {'countryCode': 'GB',\n", | |
| 317 | + " 'broadcasters': ['Sky Sports', 'NFL Game Pass on DAZN']},\n", | |
| 318 | + " {'countryCode': 'MX', 'broadcasters': ['NFL Game Pass on DAZN']},\n", | |
| 319 | + " {'countryCode': 'DE',\n", | |
| 320 | + " 'broadcasters': ['NFL Game Pass on DAZN', 'DAZN Germany (OTT)', 'RTL']},\n", | |
| 321 | + " {'countryCode': 'AU',\n", | |
| 322 | + " 'broadcasters': ['NFL Game Pass on DAZN', 'ESPN', 'TVNZ+']},\n", | |
| 323 | + " {'countryCode': 'FR',\n", | |
| 324 | + " 'broadcasters': ['NFL Game Pass on DAZN', 'beIN 2', '6Play']},\n", | |
| 325 | + " {'countryCode': 'BR', 'broadcasters': ['NFL Game Pass on DAZN', 'ESPN2']}],\n", | |
| 326 | + " 'territory': 'NATIONAL'},\n", | |
| 327 | + " 'neutralSite': None,\n", | |
| 328 | + " 'venue': {'id': '00082031-5500-35b5-a67a-7f374ebf7168',\n", | |
| 329 | + " 'name': 'Frankfurt Stadium'},\n", | |
| 330 | + " 'season': 2023,\n", | |
| 331 | + " 'seasonType': 'REG',\n", | |
| 332 | + " 'status': 'SCHEDULED',\n", | |
| 333 | + " 'week': 9,\n", | |
| 334 | + " 'weekType': 'REG',\n", | |
| 335 | + " 'externalIds': [{'source': 'elias', 'id': '2023110500'},\n", | |
| 336 | + " {'source': 'gsis', 'id': '59296'},\n", | |
| 337 | + " {'source': 'slug', 'id': 'dolphins-at-chiefs-2023-reg-9'}],\n", | |
| 338 | + " 'ticketUrl': None,\n", | |
| 339 | + " 'ticketVendors': []}" | |
| 340 | + ] | |
| 341 | + }, | |
| 342 | + "execution_count": 8, | |
| 343 | + "metadata": {}, | |
| 344 | + "output_type": "execute_result" | |
| 345 | + } | |
| 346 | + ], | |
| 347 | + "source": [ | |
| 348 | + "data = {\"content\": {\n", | |
| 349 | + " \"size\": 1484,\n", | |
| 350 | + " \"mimeType\": \"application/json\",\n", | |
| 351 | + " \"text\": \"{\\\"id\\\":\\\"b07eaa67-f053-11ed-b4a7-bab79e4492fa\\\",\\\"homeTeam\\\":{\\\"id\\\":\\\"10402310-a47e-10ea-7442-16b633633637\\\",\\\"currentLogo\\\":\\\"https://static.www.nfl.com/{formatInstructions}/league/api/clubs/logos/KC\\\",\\\"fullName\\\":\\\"Kansas City Chiefs\\\"},\\\"awayTeam\\\":{\\\"id\\\":\\\"10402700-1662-d8ad-f45c-0b0ea460d045\\\",\\\"currentLogo\\\":\\\"https://static.www.nfl.com/{formatInstructions}/league/api/clubs/logos/MIA\\\",\\\"fullName\\\":\\\"Miami Dolphins\\\"},\\\"category\\\":null,\\\"date\\\":\\\"2023-11-05\\\",\\\"time\\\":\\\"2023-11-05T14:30:00Z\\\",\\\"broadcastInfo\\\":{\\\"homeNetworkChannels\\\":[\\\"NFL NETWORK\\\"],\\\"awayNetworkChannels\\\":[\\\"NFL NETWORK\\\"],\\\"internationalWatchOptions\\\":[{\\\"countryCode\\\":\\\"CA\\\",\\\"broadcasters\\\":[\\\"DAZN Canada\\\",\\\"RDS\\\",\\\"TSN\\\"]},{\\\"countryCode\\\":\\\"GB\\\",\\\"broadcasters\\\":[\\\"Sky Sports\\\",\\\"NFL Game Pass on DAZN\\\"]},{\\\"countryCode\\\":\\\"MX\\\",\\\"broadcasters\\\":[\\\"NFL Game Pass on DAZN\\\"]},{\\\"countryCode\\\":\\\"DE\\\",\\\"broadcasters\\\":[\\\"NFL Game Pass on DAZN\\\",\\\"DAZN Germany (OTT)\\\",\\\"RTL\\\"]},{\\\"countryCode\\\":\\\"AU\\\",\\\"broadcasters\\\":[\\\"NFL Game Pass on DAZN\\\",\\\"ESPN\\\",\\\"TVNZ+\\\"]},{\\\"countryCode\\\":\\\"FR\\\",\\\"broadcasters\\\":[\\\"NFL Game Pass on DAZN\\\",\\\"beIN 2\\\",\\\"6Play\\\"]},{\\\"countryCode\\\":\\\"BR\\\",\\\"broadcasters\\\":[\\\"NFL Game Pass on DAZN\\\",\\\"ESPN2\\\"]}],\\\"territory\\\":\\\"NATIONAL\\\"},\\\"neutralSite\\\":null,\\\"venue\\\":{\\\"id\\\":\\\"00082031-5500-35b5-a67a-7f374ebf7168\\\",\\\"name\\\":\\\"Frankfurt Stadium\\\"},\\\"season\\\":2023,\\\"seasonType\\\":\\\"REG\\\",\\\"status\\\":\\\"SCHEDULED\\\",\\\"week\\\":9,\\\"weekType\\\":\\\"REG\\\",\\\"externalIds\\\":[{\\\"source\\\":\\\"elias\\\",\\\"id\\\":\\\"2023110500\\\"},{\\\"source\\\":\\\"gsis\\\",\\\"id\\\":\\\"59296\\\"},{\\\"source\\\":\\\"slug\\\",\\\"id\\\":\\\"dolphins-at-chiefs-2023-reg-9\\\"}],\\\"ticketUrl\\\":null,\\\"ticketVendors\\\":[]}\",\n", | |
| 352 | + " \"comment\": \"\"\n", | |
| 353 | + "},\n", | |
| 354 | + "}\n", | |
| 355 | + "data = data['content']['text']\n", | |
| 356 | + "import json\n", | |
| 357 | + "data = json.loads(data)\n", | |
| 358 | + "data" | |
| 359 | + ] | |
| 360 | + }, | |
| 294 | 361 | { |
| 295 | 362 | "cell_type": "markdown", |
| 296 | 363 | "metadata": {}, |