diff options
| author | Bnyro <bnyro@tutanota.com> | 2025-03-20 21:16:37 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-03-25 16:48:44 +0100 |
| commit | 4dfc47584d7c946b9682dc1e4858fae003b16d1f (patch) | |
| tree | 5dae9c70c914a7462ef302044fd5fc72a783bf0a /searx/engines/iqiyi.py | |
| parent | c28d35c7fc34da4e27700610f58c57135fea6310 (diff) | |
[refactor] duration strings: move parsing logic to utils.py
Diffstat (limited to 'searx/engines/iqiyi.py')
| -rw-r--r-- | searx/engines/iqiyi.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/searx/engines/iqiyi.py b/searx/engines/iqiyi.py index 3158b44e9..70a746bec 100644 --- a/searx/engines/iqiyi.py +++ b/searx/engines/iqiyi.py @@ -2,9 +2,10 @@ """iQiyi: A search engine for retrieving videos from iQiyi.""" from urllib.parse import urlencode -from datetime import datetime, timedelta +from datetime import datetime from searx.exceptions import SearxEngineAPIException +from searx.utils import parse_duration_string about = { "website": "https://www.iqiyi.com/", @@ -55,20 +56,7 @@ def response(resp): except (ValueError, TypeError): pass - length = None - subscript_content = album_info.get("subscriptContent") - if subscript_content: - try: - time_parts = subscript_content.split(":") - if len(time_parts) == 2: - minutes, seconds = map(int, time_parts) - length = timedelta(minutes=minutes, seconds=seconds) - elif len(time_parts) == 3: - hours, minutes, seconds = map(int, time_parts) - length = timedelta(hours=hours, minutes=minutes, seconds=seconds) - except (ValueError, TypeError): - pass - + length = parse_duration_string(album_info.get("subscriptionContent")) results.append( { 'url': album_info.get("pageUrl", "").replace("http://", "https://"), |