+ video_id = self._match_id(url)
+
+ json_url = 'http://api.vevo.com/VideoService/AuthenticateVideo?isrc=%s' % video_id
+ response = self._download_json(
+ json_url, video_id, 'Downloading video info',
+ 'Unable to download info', fatal=False) or {}
+ video_info = response.get('video') or {}
+ artist = None
+ featured_artist = None
+ uploader = None
+ view_count = None
+ formats = []
+
+ if not video_info:
+ try:
+ self._initialize_api(video_id)
+ except ExtractorError:
+ ytid = response.get('errorInfo', {}).get('ytid')
+ if ytid:
+ self.report_warning(
+ 'Video is geoblocked, trying with the YouTube video %s' % ytid)
+ return self.url_result(ytid, 'Youtube', ytid)
+
+ raise
+
+ video_info = self._call_api(
+ 'video/%s' % video_id, video_id, 'Downloading api video info',
+ 'Failed to download video info')
+
+ video_versions = self._call_api(
+ 'video/%s/streams' % video_id, video_id,
+ 'Downloading video versions info',
+ 'Failed to download video versions info',
+ fatal=False)
+
+ # Some videos are only available via webpage (e.g.
+ # https://github.com/rg3/youtube-dl/issues/9366)
+ if not video_versions:
+ webpage = self._download_webpage(url, video_id)
+ video_versions = self._extract_json(webpage, video_id, 'streams')[video_id][0]
+
+ timestamp = parse_iso8601(video_info.get('releaseDate'))
+ artists = video_info.get('artists')
+ if artists:
+ artist = uploader = artists[0]['name']
+ view_count = int_or_none(video_info.get('views', {}).get('total'))
+
+ for video_version in video_versions:
+ version = self._VERSIONS.get(video_version['version'])
+ version_url = video_version.get('url')
+ if not version_url:
+ continue
+
+ if '.ism' in version_url:
+ continue
+ elif '.mpd' in version_url:
+ formats.extend(self._extract_mpd_formats(
+ version_url, video_id, mpd_id='dash-%s' % version,
+ note='Downloading %s MPD information' % version,
+ errnote='Failed to download %s MPD information' % version,
+ fatal=False))
+ elif '.m3u8' in version_url:
+ formats.extend(self._extract_m3u8_formats(
+ version_url, video_id, 'mp4', 'm3u8_native',
+ m3u8_id='hls-%s' % version,
+ note='Downloading %s m3u8 information' % version,
+ errnote='Failed to download %s m3u8 information' % version,
+ fatal=False))
+ else:
+ m = re.search(r'''(?xi)
+ _(?P<width>[0-9]+)x(?P<height>[0-9]+)
+ _(?P<vcodec>[a-z0-9]+)
+ _(?P<vbr>[0-9]+)
+ _(?P<acodec>[a-z0-9]+)
+ _(?P<abr>[0-9]+)
+ \.(?P<ext>[a-z0-9]+)''', version_url)
+ if not m:
+ continue