- altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video|playlist).*?:.*?)"', webpage)
- if len(altMovieParams) == 0:
- raise ExtractorError('unable to find Flash URL in webpage ' + url)
- else:
- mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
-
- uri = mMovieParams[0][1]
- # Correct cc.com in uri
- uri = re.sub(r'(episode:[^.]+)(\.cc)?\.com', r'\1.cc.com', uri)
-
- index_url = 'http://%s.cc.com/feeds/mrss?%s' % (show_name, compat_urllib_parse.urlencode({'uri': uri}))
- idoc = self._download_xml(
- index_url, epTitle,
- 'Downloading show index', 'Unable to download episode index')
-
- title = idoc.find('./channel/title').text
- description = idoc.find('./channel/description').text
-
- entries = []
- item_els = idoc.findall('.//item')
- for part_num, itemEl in enumerate(item_els):
- upload_date = unified_strdate(itemEl.findall('./pubDate')[0].text)
- thumbnail = itemEl.find('.//{http://search.yahoo.com/mrss/}thumbnail').attrib.get('url')
-
- content = itemEl.find('.//{http://search.yahoo.com/mrss/}content')
- duration = float_or_none(content.attrib.get('duration'))
- mediagen_url = content.attrib['url']
- guid = itemEl.find('./guid').text.rpartition(':')[-1]
-
- cdoc = self._download_xml(
- mediagen_url, epTitle,
- 'Downloading configuration for segment %d / %d' % (part_num + 1, len(item_els)))
-
- turls = []
- for rendition in cdoc.findall('.//rendition'):
- finfo = (rendition.attrib['bitrate'], rendition.findall('./src')[0].text)
- turls.append(finfo)
-
- formats = []
- for format, rtmp_video_url in turls:
- w, h = self._video_dimensions.get(format, (None, None))
- formats.append({
- 'format_id': 'vhttp-%s' % format,
- 'url': self._transform_rtmp_url(rtmp_video_url),
- 'ext': self._video_extensions.get(format, 'mp4'),
- 'height': h,
- 'width': w,
- })
- formats.append({
- 'format_id': 'rtmp-%s' % format,
- 'url': rtmp_video_url.replace('viacomccstrm', 'viacommtvstrm'),
- 'ext': self._video_extensions.get(format, 'mp4'),
- 'height': h,
- 'width': w,
- })
- self._sort_formats(formats)
-
- virtual_id = show_name + ' ' + epTitle + ' part ' + compat_str(part_num + 1)
- entries.append({
- 'id': guid,
- 'title': virtual_id,
- 'formats': formats,
- 'uploader': show_name,
- 'upload_date': upload_date,
- 'duration': duration,
- 'thumbnail': thumbnail,
- 'description': description,
- })