Switch comedycentral IE to http downloads

This commit is contained in:
Philipp Hagemeister 2013-01-06 21:26:31 +01:00
parent 20759b340a
commit 32635ec685
1 changed files with 10 additions and 28 deletions

View File

@ -2361,16 +2361,12 @@ class ComedyCentralIE(InfoExtractor):
def report_extraction(self, episode_id): def report_extraction(self, episode_id):
self._downloader.to_screen(u'[comedycentral] %s: Extracting information' % episode_id) self._downloader.to_screen(u'[comedycentral] %s: Extracting information' % episode_id)
def report_config_download(self, episode_id): def report_config_download(self, episode_id, media_id):
self._downloader.to_screen(u'[comedycentral] %s: Downloading configuration' % episode_id) self._downloader.to_screen(u'[comedycentral] %s: Downloading configuration for %s' % (episode_id, media_id))
def report_index_download(self, episode_id): def report_index_download(self, episode_id):
self._downloader.to_screen(u'[comedycentral] %s: Downloading show index' % episode_id) self._downloader.to_screen(u'[comedycentral] %s: Downloading show index' % episode_id)
def report_player_url(self, episode_id):
self._downloader.to_screen(u'[comedycentral] %s: Determining player URL' % episode_id)
def _print_formats(self, formats): def _print_formats(self, formats):
print('Available formats:') print('Available formats:')
for x in formats: for x in formats:
@ -2437,15 +2433,6 @@ class ComedyCentralIE(InfoExtractor):
else: else:
mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])] mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
playerUrl_raw = mMovieParams[0][0]
self.report_player_url(epTitle)
try:
urlHandle = compat_urllib_request.urlopen(playerUrl_raw)
playerUrl = urlHandle.geturl()
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
self._downloader.trouble(u'ERROR: unable to find out player URL: ' + compat_str(err))
return
uri = mMovieParams[0][1] uri = mMovieParams[0][1]
indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri}) indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri})
self.report_index_download(epTitle) self.report_index_download(epTitle)
@ -2469,7 +2456,7 @@ class ComedyCentralIE(InfoExtractor):
configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' + configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' +
compat_urllib_parse.urlencode({'uri': mediaId})) compat_urllib_parse.urlencode({'uri': mediaId}))
configReq = compat_urllib_request.Request(configUrl) configReq = compat_urllib_request.Request(configUrl)
self.report_config_download(epTitle) self.report_config_download(epTitle, shortMediaId)
try: try:
configXml = compat_urllib_request.urlopen(configReq).read() configXml = compat_urllib_request.urlopen(configReq).read()
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
@ -2491,7 +2478,7 @@ class ComedyCentralIE(InfoExtractor):
return return
# For now, just pick the highest bitrate # For now, just pick the highest bitrate
format,video_url = turls[-1] format,rtmp_video_url = turls[-1]
# Get the format arg from the arg stream # Get the format arg from the arg stream
req_format = self._downloader.params.get('format', None) req_format = self._downloader.params.get('format', None)
@ -2499,16 +2486,14 @@ class ComedyCentralIE(InfoExtractor):
# Select format if we can find one # Select format if we can find one
for f,v in turls: for f,v in turls:
if f == req_format: if f == req_format:
format, video_url = f, v format, rtmp_video_url = f, v
break break
# Patch to download from alternative CDN, which does not m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url)
# break on current RTMPDump builds if not m:
broken_cdn = "rtmpe://viacomccstrmfs.fplive.net/viacomccstrm/gsp.comedystor/" raise ExtractorError(u'Cannot transform RTMP url')
better_cdn = "rtmpe://cp10740.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/" 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')
if video_url.startswith(broken_cdn):
video_url = video_url.replace(broken_cdn, better_cdn)
effTitle = showId + u'-' + epTitle effTitle = showId + u'-' + epTitle
info = { info = {
@ -2521,9 +2506,7 @@ class ComedyCentralIE(InfoExtractor):
'format': format, 'format': format,
'thumbnail': None, 'thumbnail': None,
'description': officialTitle, 'description': officialTitle,
'player_url': None #playerUrl
} }
results.append(info) results.append(info)
return results return results
@ -2603,7 +2586,6 @@ class EscapistIE(InfoExtractor):
return [info] return [info]
class CollegeHumorIE(InfoExtractor): class CollegeHumorIE(InfoExtractor):
"""Information extractor for collegehumor.com""" """Information extractor for collegehumor.com"""