mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-02-01 00:00:11 +09:00
bce2befab6
This commit introduces the `CSpanLiveIE` class to add support for C-SPAN live streams. These streams are based on the `BrightcoveNewIE` class which requires Adobe Pass MSO authentication. In order to support this new information extractor, `BrightcoveNewIE` had to be updated to support an optional Akamai token ('hdnts' query parameter) in the final m3u8 URL used by Brightcove.
27 lines
947 B
Python
27 lines
947 B
Python
# coding: utf-8
|
|
from __future__ import unicode_literals
|
|
|
|
from .brightcove import BrightcoveNewIE
|
|
from .common import InfoExtractor
|
|
from ..utils import smuggle_url
|
|
|
|
|
|
class CSpanLiveIE(InfoExtractor):
|
|
IE_NAME = 'cspanlive'
|
|
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/3162030207001/2B2qWQJYYM_default/index.html?videoId=%s'
|
|
|
|
_VALID_URL = r'^https?://(?:www\.)?c-span\.org/networks'
|
|
|
|
def _real_extract(self, url):
|
|
webpage = self._download_webpage(url, 'stream')
|
|
|
|
akamai_token = self._html_search_regex(r'data-akamaitoken="([^"]+)"', webpage, 'akamai_token')
|
|
video_id = self._html_search_regex(r'data-bcid="([^"]+)"', webpage, 'video_id')
|
|
|
|
brightcove_url = smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % video_id, {
|
|
'akamai_token': akamai_token,
|
|
'source_url': url
|
|
})
|
|
|
|
return self.url_result(brightcove_url, ie=BrightcoveNewIE.ie_key(), video_id=video_id)
|