diff --git a/core/ydcore/search.py b/core/ydcore/search.py index f99cbd5a..1b6511dd 100644 --- a/core/ydcore/search.py +++ b/core/ydcore/search.py @@ -123,7 +123,11 @@ def _parse_video(self, source: dict[Any, Any]) -> Video: video_id = source['videoId'] url = HttpUrl(f'{_YOUTUBE_BASE_URL}/watch?v={video_id}') title = _get(source, ['title', 'runs', 0, 'text']) - duration = _get(source, ['lengthText', 'simpleText']) + duration = '???' + try: + duration = _get(source, ['lengthText', 'simpleText']) + except KeyError: + pass if duration is None: duration = '--:--' thumbnails = _get(source, ['thumbnail', 'thumbnails'])