- http_urls = [{'url': node.find('filePath').text,
- 'rate': int(node.find('rate').text)}
- for node in clip_el.find('./httpURI')]
- best_quality = sorted(http_urls, key=lambda f: f['rate'])[-1]
- video_url = best_quality['url']
- title = clip_el.find('./title').text
- ext = video_url.rpartition('.')[2]
- thumbnail_url = clip_el.find('./screenGrabURI').text
- view_count = int(clip_el.find('./views').text)
- upload_date = unified_strdate(clip_el.find('./postDate').text)
+ # Transform the manifest url to a link to the mp4 files
+ # they are used in mobile devices.
+ f4m_url = data_video['videoStreams']['f4m_stream']
+ f4m_path = compat_urlparse.urlparse(f4m_url).path
+ QUALITIES_RE = r'((,\d+)+,?)'
+ qualities = self._search_regex(QUALITIES_RE, f4m_path, u'qualities').strip(',').split(',')
+ http_path = f4m_path[1:].split('/', 1)[1]
+ http_template = re.sub(QUALITIES_RE, r'%s', http_path)
+ http_template = http_template.replace('.csmil/manifest.f4m', '')
+ http_template = compat_urlparse.urljoin('http://video.gamespotcdn.com/', http_template)
+ formats = []
+ for q in qualities:
+ formats.append({
+ 'url': http_template % q,
+ 'ext': 'mp4',
+ 'format_id': q,
+ })