diff --git a/utils/downloader.py b/utils/downloader.py index fc67be6..efb67ab 100644 --- a/utils/downloader.py +++ b/utils/downloader.py @@ -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"] diff --git a/utils/input.py b/utils/input.py index 4d73c89..24ae5d1 100644 --- a/utils/input.py +++ b/utils/input.py @@ -413,8 +413,22 @@ 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(): - continue + 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) if not candidates: