1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 07:07:19 +08:00

[youtube] Duplicate upload_date to release_date

Currently if you use `%(release_date)s` in file naming templates you will
get an “NA” from YouTube downloads, because YouTube doesn’t distinguish
between “release” and “upload” and only provides “upload” date. This can be
annoying if you’re also using `youtube-dl` for other sites that do
distinguish between the two.

This change simply duplicates the found `upload_date` into `release_date`
so both variables can be used for YouTube downloads.

Fixes https://github.com/rg3/youtube-dl/issues/18704
This commit is contained in:
Frederik “Freso” S. Olesen 2019-02-17 13:31:52 +01:00
parent 388cfbd3d8
commit 4443ef264d
No known key found for this signature in database
GPG Key ID: 27628EAF5DC1403E

View File

@ -2025,6 +2025,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
video_webpage, 'upload date', default=None)
upload_date = unified_strdate(upload_date)
# release date
# YouTube doesn't provide a release date, so reuse upload date
release_date = upload_date
video_license = self._html_search_regex(
r'<h4[^>]+class="title"[^>]*>\s*License\s*</h4>\s*<ul[^>]*>\s*<li>(.+?)</li',
video_webpage, 'license', default=None)
@ -2184,6 +2188,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'channel_id': channel_id,
'channel_url': channel_url,
'upload_date': upload_date,
'release_date': release_date,
'license': video_license,
'creator': video_creator or artist,
'title': video_title,