[youtube] Fix is_live extraction (closes #21734)

This commit is contained in:
Sergey M․ 2019-07-12 03:45:58 +07:00
parent baf67a604d
commit 27019dbb4b
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -27,6 +27,7 @@ from ..compat import (
compat_str, compat_str,
) )
from ..utils import ( from ..utils import (
bool_or_none,
clean_html, clean_html,
dict_get, dict_get,
error_to_compat_str, error_to_compat_str,
@ -1890,6 +1891,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
if view_count is None and video_details: if view_count is None and video_details:
view_count = int_or_none(video_details.get('viewCount')) view_count = int_or_none(video_details.get('viewCount'))
if is_live is None:
is_live = bool_or_none(dict_get(
video_details, ('isLive', 'isLiveContent'),
skip_false_values=False))
# Check for "rental" videos # Check for "rental" videos
if 'ypc_video_rental_bar_text' in video_info and 'author' not in video_info: if 'ypc_video_rental_bar_text' in video_info and 'author' not in video_info:
raise ExtractorError('"rental" videos not supported. See https://github.com/ytdl-org/youtube-dl/issues/359 for more information.', expected=True) raise ExtractorError('"rental" videos not supported. See https://github.com/ytdl-org/youtube-dl/issues/359 for more information.', expected=True)