- if len(turls) == 0:
- self._downloader.report_error(u'unable to download ' + mediaId + ': No videos found')
- continue
-
- if self._downloader.params.get('listformats', None):
- self._print_formats([i[0] for i in turls])
- return
-
- # For now, just pick the highest bitrate
- format,rtmp_video_url = turls[-1]
-
- # Get the format arg from the arg stream
- req_format = self._downloader.params.get('format', None)
-
- # Select format if we can find one
- for f,v in turls:
- if f == req_format:
- format, rtmp_video_url = f, v
- break
-
- m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url)
- if not m:
- raise ExtractorError(u'Cannot transform RTMP url')
- base = 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=1+_pxI0=Ripod-h264+_pxL0=undefined+_pxM0=+_pxK=18639+_pxE=mp4/44620/mtvnorigin/'
- video_url = base + m.group('finalid')
-
- effTitle = showId + u'-' + epTitle + u' part ' + compat_str(partNum+1)
- info = {
- 'id': shortMediaId,
- 'url': video_url,
- 'uploader': showId,
- 'upload_date': officialDate,
- 'title': effTitle,
- 'ext': 'mp4',
- 'format': format,
- 'thumbnail': None,
- 'description': compat_str(officialTitle),
- }
- results.append(info)
-
- return results
+ 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,
+
+ 'format_note': 'HTTP 400 at the moment (patches welcome!)',
+ 'preference': -100,
+ })
+ 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,
+ })
+
+ return {
+ '_type': 'playlist',
+ 'entries': entries,
+ 'title': show_name + ' ' + title,
+ 'description': description,
+ }