|
1 | | -import base64 |
2 | 1 | import datetime |
3 | 2 | import time |
4 | 3 | import urllib.parse |
|
18 | 17 | class Api: |
19 | 18 | """This class uses the Formula 1 v1 API.""" |
20 | 19 |
|
21 | | - api_base_url = "https://api.formula1.com/v1/" |
| 20 | + api_base_url = "https://api.formula1.com" |
22 | 21 | api_key = "RNoNDmjJGUFSu1Re9GfMVzJfDClaUV47" # Extracted from public Formula 1 Android App |
23 | 22 | api_limit = 10 |
24 | 23 | api_date_format = "%Y-%m-%dT%H:%M:%S" |
25 | 24 |
|
26 | 25 | # API endpoints |
27 | | - api_path_editorial = "editorial-assemblies/videos/2BiKQUC040cmuysoQsgwcK" |
28 | | - api_path_videos = "video-assets/videos" |
29 | | - api_path_constructors = "editorial-constructorlisting/listing" |
30 | | - api_path_drivers = "editorial-driverlisting/listing" |
31 | | - api_path_events = "editorial-eventlisting/events" |
32 | | - api_path_results = "fom-results/raceresults" |
| 26 | + api_path_editorial = "/v1/editorial-assemblies/videos/2BiKQUC040cmuysoQsgwcK" |
| 27 | + api_path_videos = "/v1/video-assets/videos" |
| 28 | + api_path_constructors = "/v1/editorial-constructorlisting/listing" |
| 29 | + api_path_drivers = "/v1/editorial-driverlisting/listing" |
| 30 | + api_path_events = "/v1/editorial-eventlisting/events" |
33 | 31 |
|
34 | 32 | # Brightcove (https://www.brightcove.com/) |
35 | 33 | # Policy key is hardcoded and was extracted from public Formula 1 Android App |
@@ -141,9 +139,6 @@ def _map_json_to_collection(self, json_obj): |
141 | 139 | elif "events" in json_obj: |
142 | 140 | items = json_obj.get("events") |
143 | 141 | item_type = "events" |
144 | | - elif "raceresults" in json_obj: |
145 | | - items = json_obj.get("raceresults") |
146 | | - item_type = "events" |
147 | 142 | elif "raceResultsRace" in json_obj: |
148 | 143 | items = json_obj.get("raceResultsRace").get("results", []) |
149 | 144 | item_type = "raceresult" |
|
0 commit comments