- webpage, 'region', fatal=False, default='US')
- data = compat_urllib_parse_urlencode({
- 'protocol': 'http',
- 'region': region.upper(),
- })
- query_url = (
- 'https://video.media.yql.yahoo.com/v1/video/sapi/streams/'
- '{id}?{data}'.format(id=video_id, data=data))
- query_result = self._download_json(
- query_url, display_id, 'Downloading video info')
- return self._extract_info(display_id, query_result, webpage)
+ webpage, 'region', fatal=False, default='US').upper()
+ formats = []
+ info = {}
+ for fmt in ('webm', 'mp4'):
+ query_result = self._download_json(
+ 'https://video.media.yql.yahoo.com/v1/video/sapi/streams/' + video_id,
+ display_id, 'Downloading %s video info' % fmt, query={
+ 'protocol': 'http',
+ 'region': region,
+ 'format': fmt,
+ })
+ info = self._extract_info(display_id, query_result, webpage)
+ formats.extend(info['formats'])
+ formats.extend(self._extract_m3u8_formats(
+ 'http://video.media.yql.yahoo.com/v1/hls/%s?region=%s' % (video_id, region),
+ video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
+ self._sort_formats(formats)
+ info['formats'] = formats
+ return info