X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fvevo.py;h=d2ffd1b6ba893f2cb2cc50f00a3131a835dba97d;hb=cc7fec5818254f4679896823c7de9d17f50201ca;hp=c3360f16676183b868eeb495b5552e9a459477c3;hpb=aba77bbfc275440af00ab4bfe8de2733009f4bd8;p=youtube-dl diff --git a/youtube_dl/extractor/vevo.py b/youtube_dl/extractor/vevo.py index c3360f166..d2ffd1b6b 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,7 +34,8 @@ class VevoIE(InfoExtractor): "duration": 230.12, "width": 1920, "height": 1080, - 'timestamp': 1372057200, + # timestamp and upload_date are often incorrect; seem to change randomly + 'timestamp': int, } }, { 'note': 'v3 SMIL format', @@ -47,7 +49,7 @@ class VevoIE(InfoExtractor): 'title': 'I Wish I Could Break Your Heart', 'duration': 226.101, 'age_limit': 0, - 'timestamp': 1392796919, + 'timestamp': int, } }, { 'note': 'Age-limited video', @@ -58,7 +60,6 @@ class VevoIE(InfoExtractor): 'age_limit': 18, 'title': 'Tunnel Vision (Explicit)', 'uploader': 'Justin Timberlake', - # timestamp and upload_date are often incorrect; seem to change randomly 'upload_date': 're:2013070[34]', 'timestamp': int, }, @@ -133,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) @@ -170,6 +177,7 @@ class VevoIE(InfoExtractor): self._downloader.report_warning( 'Cannot download SMIL information, falling back to JSON ..') + self._sort_formats(formats) timestamp_ms = int(self._search_regex( r'/Date\((\d+)\)/', video_info['launchDate'], 'launch date'))