-class NineCNineMediaBaseIE(InfoExtractor):
- _API_BASE_TEMPLATE = 'http://capi.9c9media.com/destinations/%s/platforms/desktop/contents/%s/'
-
-
-class NineCNineMediaStackIE(NineCNineMediaBaseIE):
- IE_NAME = '9c9media:stack'
- _GEO_COUNTRIES = ['CA']
- _VALID_URL = r'9c9media:stack:(?P<destination_code>[^:]+):(?P<content_id>\d+):(?P<content_package>\d+):(?P<id>\d+)'
-
- def _real_extract(self, url):
- destination_code, content_id, package_id, stack_id = re.match(self._VALID_URL, url).groups()
- stack_base_url_template = self._API_BASE_TEMPLATE + 'contentpackages/%s/stacks/%s/manifest.'
- stack_base_url = stack_base_url_template % (destination_code, content_id, package_id, stack_id)
-
- formats = []
- formats.extend(self._extract_m3u8_formats(
- stack_base_url + 'm3u8', stack_id, 'mp4',
- 'm3u8_native', m3u8_id='hls', fatal=False))
- formats.extend(self._extract_f4m_formats(
- stack_base_url + 'f4m', stack_id,
- f4m_id='hds', fatal=False))
- mp4_url = self._download_webpage(stack_base_url + 'pd', stack_id, fatal=False)
- if mp4_url:
- formats.append({
- 'url': mp4_url,
- 'format_id': 'mp4',
- })
- self._sort_formats(formats)
-
- return {
- 'id': stack_id,
- 'formats': formats,
- }
-
-
-class NineCNineMediaIE(NineCNineMediaBaseIE):