From 6b1d8c1e3038e7f0977ad36027f9f3ff61d27f46 Mon Sep 17 00:00:00 2001 From: CXwudi Date: Sun, 25 Apr 2021 19:53:57 -0700 Subject: [PATCH] [niconico] Fix title and thumbnail extraction (#273) Authored by: CXwudi --- yt_dlp/extractor/niconico.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/niconico.py b/yt_dlp/extractor/niconico.py index 84437e450..91924b318 100644 --- a/yt_dlp/extractor/niconico.py +++ b/yt_dlp/extractor/niconico.py @@ -493,7 +493,8 @@ def get_video_info_xml(items): # Start extracting information title = ( - get_video_info_web(['originalTitle', 'title']) + get_video_info_xml('title') # prefer to get the untranslated original title + or get_video_info_web(['originalTitle', 'title']) or self._og_search_title(webpage, default=None) or self._html_search_regex( r']+class="videoHeaderTitle"[^>]*>([^<]+)', @@ -507,7 +508,9 @@ def get_video_info_xml(items): thumbnail = ( self._html_search_regex(r'', webpage, 'thumbnail data', default=None) - or get_video_info_web(['thumbnail_url', 'largeThumbnailURL', 'thumbnailURL']) + or try_get( # choose highest from 720p to 240p + get_video_info_web('thumbnail'), + ['ogp', 'player', 'largeUrl', 'middleUrl', 'url']) or self._html_search_meta('image', webpage, 'thumbnail', default=None) or video_detail.get('thumbnail'))