mirror of
https://github.com/NohamR/OqeeRewind.git
synced 2026-01-11 00:28:16 +00:00
Improve error handling and track selection logic
This commit is contained in:
@@ -19,6 +19,7 @@ def fetch_drm_keys(kid: str, api_url: str, api_key: str) -> str:
|
|||||||
}
|
}
|
||||||
data = {"service": "oqee", "kid": kid}
|
data = {"service": "oqee", "kid": kid}
|
||||||
response = requests.post(api_url, headers=headers, json=data, timeout=10)
|
response = requests.post(api_url, headers=headers, json=data, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
return response.json()["key"]
|
return response.json()["key"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -413,8 +413,22 @@ def select_track(content_dict, quality_spec, content_type):
|
|||||||
|
|
||||||
candidates = []
|
candidates = []
|
||||||
for key, tracks in content_dict.items():
|
for key, tracks in content_dict.items():
|
||||||
if filter_part and filter_part.lower() not in key.lower():
|
if filter_part:
|
||||||
continue
|
should_skip = True
|
||||||
|
if content_type == "video" and "x" in key:
|
||||||
|
# For video, check height
|
||||||
|
try:
|
||||||
|
_, height = key.split("x")
|
||||||
|
if filter_part.endswith("p"):
|
||||||
|
target_height = filter_part[:-1]
|
||||||
|
else:
|
||||||
|
target_height = filter_part
|
||||||
|
if target_height in height:
|
||||||
|
should_skip = False
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
if should_skip and filter_part.lower() not in key.lower():
|
||||||
|
continue
|
||||||
candidates.extend(tracks)
|
candidates.extend(tracks)
|
||||||
|
|
||||||
if not candidates:
|
if not candidates:
|
||||||
|
|||||||
Reference in New Issue
Block a user