diff options
author | CXwudi <cx2010017@gmail.com> | 2021-04-25 19:53:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 08:23:57 +0530 |
commit | 6b1d8c1e3038e7f0977ad36027f9f3ff61d27f46 (patch) | |
tree | 3776b384e5566d924f3146ee0e7c112afb461b30 | |
parent | 87c3d06271430c952f9ed950f0d422534eaad1b3 (diff) | |
download | hypervideo-pre-6b1d8c1e3038e7f0977ad36027f9f3ff61d27f46.tar.lz hypervideo-pre-6b1d8c1e3038e7f0977ad36027f9f3ff61d27f46.tar.xz hypervideo-pre-6b1d8c1e3038e7f0977ad36027f9f3ff61d27f46.zip |
[niconico] Fix title and thumbnail extraction (#273)
Authored by: CXwudi
-rw-r--r-- | yt_dlp/extractor/niconico.py | 7 |
1 files 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 @@ class NiconicoIE(InfoExtractor): # 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'<span[^>]+class="videoHeaderTitle"[^>]*>([^<]+)</span>', @@ -507,7 +508,9 @@ class NiconicoIE(InfoExtractor): thumbnail = ( self._html_search_regex(r'<meta property="og:image" content="([^"]+)">', 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')) |