Skip to content
This repository has been archived by the owner on Jun 21, 2021. It is now read-only.

Commit

Permalink
[niconico] Fix title and thumbnail extraction (blackjack4494#273)
Browse files Browse the repository at this point in the history
Authored by: CXwudi
  • Loading branch information
CXwudi authored Apr 26, 2021
1 parent 87c3d06 commit 6b1d8c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions yt_dlp/extractor/niconico.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<span[^>]+class="videoHeaderTitle"[^>]*>([^<]+)</span>',
Expand All @@ -507,7 +508,9 @@ def get_video_info_xml(items):

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'))

Expand Down

0 comments on commit 6b1d8c1

Please sign in to comment.