Skip to content

Commit

Permalink
[youtube] Use localized title & description
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsir911 committed Mar 27, 2021
1 parent 8562218 commit 378a533
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,24 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'url': 'https://www.youtube.com/watch?v=nGC3D_FkCmg',
'only_matching': True,
},
{
# Translated title
'url': 'UnIhRpIT7nc',
'info_dict': {
'id': 'UnIhRpIT7nc',
'ext': 'mp4',
'title': 'inabakumori - Lagtrain (Vo. Kaai Yuki) / 稲葉曇『ラグトレイン』Vo. 歌愛ユキ',
# Translated description
'description': 'md5:d0865e57701acd99b4d89679a66e9632',
'upload_date': '20200716',
'uploader': '稲葉曇',
'uploader_id': 'UCNElM45JypxqAR73RoUQ10g',
'uploader_url': r're:https?://(?:www\.)?youtube\.com/channel/UCNElM45JypxqAR73RoUQ10g',
},
'params': {
'skip_download': True,
},
},
]
_formats = {
'5': {'ext': 'flv', 'width': 400, 'height': 240, 'acodec': 'mp3', 'abr': 64, 'vcodec': 'h263'},
Expand Down Expand Up @@ -1479,10 +1497,11 @@ def get_text(x):
player_response,
lambda x: x['microformat']['playerMicroformatRenderer'],
dict) or {}
video_title = video_details.get('title') \
or get_text(microformat.get('title')) \
video_title = get_text(microformat.get('title')) \
or video_details.get('title') \
or search_meta(['og:title', 'twitter:title', 'title'])
video_description = video_details.get('shortDescription')
video_description = get_text(microformat.get('description')) \
or video_details.get('shortDescription')

if not smuggled_data.get('force_singlefeed', False):
if not self._downloader.params.get('noplaylist'):
Expand Down

0 comments on commit 378a533

Please sign in to comment.