- mobj = re.match(self._VALID_URL, url)
-
- if mobj.group('shortname'):
- return self.url_result('http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes')
-
- if mobj.group('clip'):
- if mobj.group('videotitle'):
- epTitle = mobj.group('videotitle')
- elif mobj.group('showname') == 'thedailyshow':
- epTitle = mobj.group('tdstitle')
- else:
- epTitle = mobj.group('cntitle')
- dlNewest = False
- elif mobj.group('interview'):
- epTitle = mobj.group('interview_title')
- dlNewest = False
- else:
- dlNewest = not mobj.group('episode')
- if dlNewest:
- epTitle = mobj.group('showname')
- else:
- epTitle = mobj.group('episode')
- show_name = mobj.group('showname')
-
- webpage, htmlHandle = self._download_webpage_handle(url, epTitle)
- if dlNewest:
- url = htmlHandle.geturl()
- mobj = re.match(self._VALID_URL, url, re.VERBOSE)
- if mobj is None:
- raise ExtractorError('Invalid redirected URL: ' + url)
- if mobj.group('episode') == '':
- raise ExtractorError('Redirected URL is still not specific: ' + url)
- epTitle = (mobj.group('episode') or mobj.group('videotitle')).rpartition('/')[-1]
-
- mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
- if len(mMovieParams) == 0:
- # The Colbert Report embeds the information in a without
- # a URL prefix; so extract the alternate reference
- # and then add the URL prefix manually.
-
- 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.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')