- t = re.search(self._TITLE, html)
- if not t:
- raise ExtractorError(u'no title found')
- title = t.group('title1') + t.group('title2')
- m = re.search(self._MEDIA_XML, html)
- if not m:
- raise ExtractorError(u'no xml found')
- xmlurl = m.group('xmlurl')
- xml = self._download_webpage(domain+xmlurl, video_id, 'download XML').replace('\n','').replace('\r','').replace('<asset>','\n<asset>').replace('</asset>','</asset>\n')
- if(mediatype == "video"):
- streams = [mo.groupdict() for mo in re.finditer(self._MEDIA_STREAM_VIDEO, xml)]
- if not streams:
- raise ExtractorError(u'no media found')
- # choose default media type and highest quality for now
- stream = max([s for s in streams if s["progressiveDownloadUrl"].startswith("http://") ],
- key=lambda s: int(s["frameWidth"]))
- else:
- streams = [mo.groupdict() for mo in re.finditer(self._MEDIA_STREAM_AUDIO, xml)]
- if not streams:
- raise ExtractorError(u'no media found')
- # choose default media type (MP4) and highest quality for now
- stream = max([s for s in streams if s["progressiveDownloadUrl"].startswith("http://") and s["mediaType"] == "MP4" ],
- key=lambda s: int(s["bitrateAudio"]))