X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fvevo.py;h=eada13ce920b9f4e892f952242ef87bfac504600;hb=c081b35c27b8e2f1735c62933709448c1a675f72;hp=7c97b9b364efc8c47ef3594e4382222ba2b09d5a;hpb=9d2ecdbc712d4e500dd0207041392b143082ad00;p=youtube-dl diff --git a/youtube_dl/extractor/vevo.py b/youtube_dl/extractor/vevo.py index 7c97b9b36..eada13ce9 100644 --- a/youtube_dl/extractor/vevo.py +++ b/youtube_dl/extractor/vevo.py @@ -16,11 +16,12 @@ class VevoIE(InfoExtractor): (currently used by MTVIE) """ _VALID_URL = r'''(?x) - (?:https?://www\.vevo\.com/watch/(?:[^/]+/[^/]+/)?| + (?:https?://www\.vevo\.com/watch/(?:[^/]+/(?:[^/]+/)?)?| https?://cache\.vevo\.com/m/html/embed\.html\?video=| https?://videoplayer\.vevo\.com/embed/embedded\?videoId=| vevo:) (?P[^&?#]+)''' + _TESTS = [{ 'url': 'http://www.vevo.com/watch/hurts/somebody-to-die-for/GB1101300280', "md5": "06bea460acb744eab74a9d7dcb4bfd61", @@ -33,6 +34,8 @@ class VevoIE(InfoExtractor): "duration": 230.12, "width": 1920, "height": 1080, + # timestamp and upload_date are often incorrect; seem to change randomly + 'timestamp': int, } }, { 'note': 'v3 SMIL format', @@ -46,6 +49,7 @@ class VevoIE(InfoExtractor): 'title': 'I Wish I Could Break Your Heart', 'duration': 226.101, 'age_limit': 0, + 'timestamp': int, } }, { 'note': 'Age-limited video', @@ -56,8 +60,8 @@ class VevoIE(InfoExtractor): 'age_limit': 18, 'title': 'Tunnel Vision (Explicit)', 'uploader': 'Justin Timberlake', - 'upload_date': '20130704', - 'upload_timestamp': 1372906800, + 'upload_date': 're:2013070[34]', + 'timestamp': int, }, 'params': { 'skip_download': 'true', @@ -130,7 +134,13 @@ class VevoIE(InfoExtractor): video_id = mobj.group('id') json_url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s' % video_id - video_info = self._download_json(json_url, video_id)['video'] + response = self._download_json(json_url, video_id) + video_info = response['video'] + + if not video_info: + if 'statusMessage' in response: + raise ExtractorError('%s said: %s' % (self.IE_NAME, response['statusMessage']), expected=True) + raise ExtractorError('Unable to extract videos') formats = self._formats_from_json(video_info) @@ -175,7 +185,7 @@ class VevoIE(InfoExtractor): 'title': video_info['title'], 'formats': formats, 'thumbnail': video_info['imageUrl'], - 'upload_timestamp': timestamp_ms // 1000, + 'timestamp': timestamp_ms // 1000, 'uploader': video_info['mainArtists'][0]['artistName'], 'duration': video_info['duration'], 'age_limit': age_limit,