- indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri})
- idoc = self._download_xml(indexUrl, epTitle,
- 'Downloading show index',
- 'unable to download episode index')
-
- results = []
-
- itemEls = idoc.findall('.//item')
- for partNum,itemEl in enumerate(itemEls):
- mediaId = itemEl.findall('./guid')[0].text
- shortMediaId = mediaId.split(':')[-1]
- showId = mediaId.split(':')[-2].replace('.com', '')
- officialTitle = itemEl.findall('./title')[0].text
- officialDate = unified_strdate(itemEl.findall('./pubDate')[0].text)
-
- configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' +
- compat_urllib_parse.urlencode({'uri': mediaId}))
- cdoc = self._download_xml(configUrl, epTitle,
- 'Downloading configuration for %s' % shortMediaId)
+ # 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)))