mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-11 19:40:45 +00:00
[utils] Add try_call
This commit is contained in:
@@ -5,6 +5,7 @@ from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
int_or_none,
|
||||
qualities,
|
||||
try_call,
|
||||
try_get,
|
||||
ExtractorError,
|
||||
)
|
||||
@@ -26,10 +27,10 @@ class WhoWatchIE(InfoExtractor):
|
||||
metadata = self._download_json('https://api.whowatch.tv/lives/%s' % video_id, video_id)
|
||||
live_data = self._download_json('https://api.whowatch.tv/lives/%s/play' % video_id, video_id)
|
||||
|
||||
title = try_get(None, (
|
||||
lambda x: live_data['share_info']['live_title'][1:-1],
|
||||
lambda x: metadata['live']['title'],
|
||||
), compat_str)
|
||||
title = try_call(
|
||||
lambda: live_data['share_info']['live_title'][1:-1],
|
||||
lambda: metadata['live']['title'],
|
||||
expected_type=str)
|
||||
|
||||
hls_url = live_data.get('hls_url')
|
||||
if not hls_url:
|
||||
|
||||
Reference in New Issue
Block a user