mirror of
https://github.com/NohamR/OqeeRewind.git
synced 2026-01-10 08:08:20 +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}
|
||||
response = requests.post(api_url, headers=headers, json=data, timeout=10)
|
||||
response.raise_for_status()
|
||||
return response.json()["key"]
|
||||
|
||||
|
||||
|
||||
@@ -413,7 +413,21 @@ def select_track(content_dict, quality_spec, content_type):
|
||||
|
||||
candidates = []
|
||||
for key, tracks in content_dict.items():
|
||||
if filter_part and filter_part.lower() not in key.lower():
|
||||
if filter_part:
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user