mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-27 17:08:32 +00:00
fix
This commit is contained in:
parent
66273ed7c0
commit
f0b0cc6371
@ -10,29 +10,21 @@
|
|||||||
try_call,
|
try_call,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
)
|
)
|
||||||
from ..utils.traversal import traverse_obj
|
from ..utils.traversal import require, traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class CiscoLiveBaseIE(InfoExtractor):
|
class CiscoLiveBaseIE(InfoExtractor):
|
||||||
_BASE_URL = 'https://www.ciscolive.com'
|
_BASE_URL = 'https://www.ciscolive.com'
|
||||||
_TOKEN = None
|
_HEADERS = {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
def _real_initialize(self):
|
'Rfapiprofileid': 'HEedDIRblcZk7Ld3KHm1T0VUtZog9eG9',
|
||||||
self._TOKEN = try_call(lambda: self._get_cookies(self._BASE_URL)['rfjwt'].value)
|
'Rfwidgetid': 'M7n14I8sz0pklW1vybwVRdKrgdREj8sR',
|
||||||
if not self._TOKEN:
|
}
|
||||||
self.raise_login_required()
|
|
||||||
|
|
||||||
def _call_api(self, endpoint, some_id, payload=None, doseq=False, **kwargs):
|
|
||||||
if endpoint != 'search':
|
|
||||||
payload = {'id': some_id}
|
|
||||||
|
|
||||||
|
def _call_api(self, endpoint, payload, doseq=False, **kwargs):
|
||||||
api_resp = self._download_json(
|
api_resp = self._download_json(
|
||||||
f'https://events.rainfocus.com/api/{endpoint}', some_id, headers={
|
f'https://events.rainfocus.com/api/{endpoint}', payload.get('id'),
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
headers=self._HEADERS, data=urlencode_postdata(payload, doseq=doseq), **kwargs)
|
||||||
'Rfapiprofileid': 'HEedDIRblcZk7Ld3KHm1T0VUtZog9eG9',
|
|
||||||
'Rfauthtoken': self._TOKEN,
|
|
||||||
'Rfwidgetid': 'M7n14I8sz0pklW1vybwVRdKrgdREj8sR',
|
|
||||||
}, data=urlencode_postdata(payload, doseq=doseq), **kwargs)
|
|
||||||
if traverse_obj(api_resp, 'responseCode') != '0':
|
if traverse_obj(api_resp, 'responseCode') != '0':
|
||||||
msg = traverse_obj(api_resp, ('responseMessage', {str}, filter))
|
msg = traverse_obj(api_resp, ('responseMessage', {str}, filter))
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@ -58,12 +50,12 @@ class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
|||||||
'duration': 2921.387,
|
'duration': 2921.387,
|
||||||
'series': 'Cisco Live On Demand',
|
'series': 'Cisco Live On Demand',
|
||||||
'series_id': '1749591952508001pGUf',
|
'series_id': '1749591952508001pGUf',
|
||||||
'tags': [],
|
|
||||||
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
||||||
'timestamp': 1749602136,
|
'timestamp': 1749602136,
|
||||||
'upload_date': '20250611',
|
'upload_date': '20250611',
|
||||||
'uploader_id': '5647924234001',
|
'uploader_id': '5647924234001',
|
||||||
},
|
},
|
||||||
|
'add_ie': ['BrightcoveNew'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html#/video/1749603837855001eWhB',
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html#/video/1749603837855001eWhB',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -76,12 +68,12 @@ class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
|||||||
'duration': 2921.387,
|
'duration': 2921.387,
|
||||||
'series': 'Cisco Live On Demand',
|
'series': 'Cisco Live On Demand',
|
||||||
'series_id': '1749591952508001pGUf',
|
'series_id': '1749591952508001pGUf',
|
||||||
'tags': [],
|
|
||||||
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
||||||
'timestamp': 1749602136,
|
'timestamp': 1749602136,
|
||||||
'upload_date': '20250611',
|
'upload_date': '20250611',
|
||||||
'uploader_id': '5647924234001',
|
'uploader_id': '5647924234001',
|
||||||
},
|
},
|
||||||
|
'add_ie': ['BrightcoveNew'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?search.sessiontype=Keynote#/session/1748956425383001aEIK',
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?search.sessiontype=Keynote#/session/1748956425383001aEIK',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -94,18 +86,23 @@ class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
|||||||
'duration': 4405.739,
|
'duration': 4405.739,
|
||||||
'series': 'Cisco Live On Demand',
|
'series': 'Cisco Live On Demand',
|
||||||
'series_id': '1748956425383001aEIK',
|
'series_id': '1748956425383001aEIK',
|
||||||
'tags': [],
|
|
||||||
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
'thumbnail': r're:https?://cf-images\.us-east-1\.prod\.boltdns\.net/.+\.jpg',
|
||||||
'timestamp': 1748553118,
|
'timestamp': 1748553118,
|
||||||
'upload_date': '20250529',
|
'upload_date': '20250529',
|
||||||
'uploader_id': '5647924234001',
|
'uploader_id': '5647924234001',
|
||||||
},
|
},
|
||||||
|
'add_ie': ['BrightcoveNew'],
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url_type, display_id = self._match_valid_url(url).group('type', 'id')
|
url_type, display_id = self._match_valid_url(url).group('type', 'id')
|
||||||
if url_type == 'video':
|
if url_type == 'video':
|
||||||
file = self._call_api('file', display_id)
|
auth_token = try_call(lambda: self._get_cookies(self._BASE_URL)['rfjwt'].value)
|
||||||
|
if not auth_token:
|
||||||
|
self.raise_login_required()
|
||||||
|
|
||||||
|
self._HEADERS['Rfauthtoken'] = auth_token
|
||||||
|
file = self._call_api('file', {'id': display_id})
|
||||||
rf_id = traverse_obj(file, ('items', 'file', 'rainfocusId', {str}))
|
rf_id = traverse_obj(file, ('items', 'file', 'rainfocusId', {str}))
|
||||||
else:
|
else:
|
||||||
rf_id = display_id
|
rf_id = display_id
|
||||||
@ -114,13 +111,14 @@ def _real_extract(self, url):
|
|||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'ie_key': 'BrightcoveNew',
|
'ie_key': 'BrightcoveNew',
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
**traverse_obj(self._call_api('session', rf_id), ('items', ..., {
|
**traverse_obj(self._call_api('session', {'id': rf_id}), ('items', ..., {
|
||||||
'title': ('title', {clean_html}),
|
'title': ('title', {clean_html}),
|
||||||
'creators': ('participants', ..., 'fullName', {str}),
|
'creators': ('participants', ..., 'fullName', {str}),
|
||||||
'description': ('abstract', {clean_html}),
|
'description': ('abstract', {clean_html}),
|
||||||
'series': ('eventName', {clean_html}),
|
'series': ('eventName', {clean_html}),
|
||||||
'series_id': ('sessionID', {str}),
|
'series_id': ('sessionID', {str}),
|
||||||
'url': ('videos', ..., 'url', {str_or_none}, {lambda x: self.BRIGHTCOVE_URL_TEMPLATE % x}, any),
|
'url': ('videos', ..., 'url', {str_or_none},
|
||||||
|
{lambda x: self.BRIGHTCOVE_URL_TEMPLATE % x}, any, {require('brightcove video ID')}),
|
||||||
}, any)),
|
}, any)),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,10 +150,8 @@ def _entries(self, payload):
|
|||||||
|
|
||||||
for page in itertools.count(1):
|
for page in itertools.count(1):
|
||||||
search = self._call_api(
|
search = self._call_api(
|
||||||
'search', None, {
|
'search', {**payload, 'from': from_val},
|
||||||
**payload,
|
doseq=True, note=f'Downloading page {page}')
|
||||||
'from': from_val,
|
|
||||||
}, True, note=f'Downloading page {page}')
|
|
||||||
if not traverse_obj(search, 'sectionList'):
|
if not traverse_obj(search, 'sectionList'):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user