mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2025-12-08 04:46:44 +03:00
Improve logging when an error occurs while getting segments
This commit is contained in:
@@ -113,11 +113,17 @@ class ApiHelper:
|
|||||||
headers = {"Accept": "application/json"}
|
headers = {"Accept": "application/json"}
|
||||||
url = constants.SponsorBlock_api + "skipSegments/" + vid_id_hashed
|
url = constants.SponsorBlock_api + "skipSegments/" + vid_id_hashed
|
||||||
async with self.web_session.get(url, headers=headers, params=params) as response:
|
async with self.web_session.get(url, headers=headers, params=params) as response:
|
||||||
response = await response.json()
|
response_json = await response.json()
|
||||||
for i in response:
|
if(response.status != 200):
|
||||||
|
print(f"Error getting segments. Code: {response.status} - {response.text}")
|
||||||
|
return ([], True)
|
||||||
|
for i in response_json:
|
||||||
if str(i["videoID"]) == str(vid_id):
|
if str(i["videoID"]) == str(vid_id):
|
||||||
response = i
|
response_json = i
|
||||||
break
|
break
|
||||||
|
return self.process_segments(response)
|
||||||
|
|
||||||
|
def process_segments(response):
|
||||||
segments = []
|
segments = []
|
||||||
ignore_ttl = True
|
ignore_ttl = True
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user