mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-01 10:47:26 +01:00
[vimeo] Extract upload timestamp
This commit is contained in:
parent
c38a67bcd5
commit
c15cd29640
@ -21,7 +21,9 @@ from ..utils import (
|
|||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
std_headers,
|
std_headers,
|
||||||
|
try_get,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
|
unified_timestamp,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
@ -213,6 +215,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
|
'title': "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
|
||||||
'description': 'md5:2d3305bad981a06ff79f027f19865021',
|
'description': 'md5:2d3305bad981a06ff79f027f19865021',
|
||||||
|
'timestamp': 1355990239,
|
||||||
'upload_date': '20121220',
|
'upload_date': '20121220',
|
||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user7108434',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user7108434',
|
||||||
'uploader_id': 'user7108434',
|
'uploader_id': 'user7108434',
|
||||||
@ -259,6 +262,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'id': '68375962',
|
'id': '68375962',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'youtube-dl password protected test video',
|
'title': 'youtube-dl password protected test video',
|
||||||
|
'timestamp': 1371200155,
|
||||||
'upload_date': '20130614',
|
'upload_date': '20130614',
|
||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128',
|
||||||
'uploader_id': 'user18948128',
|
'uploader_id': 'user18948128',
|
||||||
@ -281,7 +285,8 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/atencio',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/atencio',
|
||||||
'uploader_id': 'atencio',
|
'uploader_id': 'atencio',
|
||||||
'uploader': 'Peter Atencio',
|
'uploader': 'Peter Atencio',
|
||||||
'upload_date': '20130927',
|
'timestamp': 1380339469,
|
||||||
|
'upload_date': '20130928',
|
||||||
'duration': 187,
|
'duration': 187,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -293,6 +298,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'The New Vimeo Player (You Know, For Videos)',
|
'title': 'The New Vimeo Player (You Know, For Videos)',
|
||||||
'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
|
'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
|
||||||
|
'timestamp': 1381846109,
|
||||||
'upload_date': '20131015',
|
'upload_date': '20131015',
|
||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/staff',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/staff',
|
||||||
'uploader_id': 'staff',
|
'uploader_id': 'staff',
|
||||||
@ -324,6 +330,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'uploader': 'The DMCI',
|
'uploader': 'The DMCI',
|
||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/dmci',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/dmci',
|
||||||
'uploader_id': 'dmci',
|
'uploader_id': 'dmci',
|
||||||
|
'timestamp': 1324343742,
|
||||||
'upload_date': '20111220',
|
'upload_date': '20111220',
|
||||||
'description': 'md5:ae23671e82d05415868f7ad1aec21147',
|
'description': 'md5:ae23671e82d05415868f7ad1aec21147',
|
||||||
},
|
},
|
||||||
@ -339,6 +346,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
'uploader': 'Casey Donahue',
|
'uploader': 'Casey Donahue',
|
||||||
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/caseydonahue',
|
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/caseydonahue',
|
||||||
'uploader_id': 'caseydonahue',
|
'uploader_id': 'caseydonahue',
|
||||||
|
'timestamp': 1250886430,
|
||||||
'upload_date': '20090821',
|
'upload_date': '20090821',
|
||||||
'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6',
|
'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6',
|
||||||
},
|
},
|
||||||
@ -488,6 +496,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
expected=True)
|
expected=True)
|
||||||
|
|
||||||
cc_license = None
|
cc_license = None
|
||||||
|
timestamp = None
|
||||||
|
|
||||||
# Extract the config JSON
|
# Extract the config JSON
|
||||||
try:
|
try:
|
||||||
@ -505,6 +514,9 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
page_config = self._parse_json(vimeo_clip_page_config, video_id)
|
page_config = self._parse_json(vimeo_clip_page_config, video_id)
|
||||||
config_url = page_config['player']['config_url']
|
config_url = page_config['player']['config_url']
|
||||||
cc_license = page_config.get('cc_license')
|
cc_license = page_config.get('cc_license')
|
||||||
|
timestamp = try_get(
|
||||||
|
page_config, lambda x: x['clip']['uploaded_on'],
|
||||||
|
compat_str)
|
||||||
config_json = self._download_webpage(config_url, video_id)
|
config_json = self._download_webpage(config_url, video_id)
|
||||||
config = json.loads(config_json)
|
config = json.loads(config_json)
|
||||||
except RegexNotFoundError:
|
except RegexNotFoundError:
|
||||||
@ -573,10 +585,10 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
self._downloader.report_warning('Cannot find video description')
|
self._downloader.report_warning('Cannot find video description')
|
||||||
|
|
||||||
# Extract upload date
|
# Extract upload date
|
||||||
video_upload_date = None
|
if not timestamp:
|
||||||
mobj = re.search(r'<time[^>]+datetime="([^"]+)"', webpage)
|
timestamp = self._search_regex(
|
||||||
if mobj is not None:
|
r'<time[^>]+datetime="([^"]+)"', webpage,
|
||||||
video_upload_date = unified_strdate(mobj.group(1))
|
'timestamp', default=None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
|
view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
|
||||||
@ -622,7 +634,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
info_dict.update({
|
info_dict.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'upload_date': video_upload_date,
|
'timestamp': unified_timestamp(timestamp),
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'webpage_url': url,
|
'webpage_url': url,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
|
Loading…
Reference in New Issue
Block a user