mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-23 21:58:29 +00:00
Apply review suggestions
This commit is contained in:
parent
025c410414
commit
a075e47a28
@ -2288,7 +2288,7 @@
|
||||
)
|
||||
from .umg import UMGDeIE
|
||||
from .unistra import UnistraIE
|
||||
from .unitednation import UnitedNationWebTVExtractorIE
|
||||
from .unitednations import UnitedNationsWebTVIE
|
||||
from .unity import UnityIE
|
||||
from .unsupported import (
|
||||
KnownDRMIE,
|
||||
|
@ -1,7 +1,8 @@
|
||||
from .common import InfoExtractor
|
||||
from .kaltura import KalturaIE
|
||||
|
||||
|
||||
class UnitedNationWebTVExtractorIE(KalturaIE):
|
||||
class UnitedNationsWebTVIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://webtv.un.org/(ar|zh|en|fr|ru|es)/asset/\w+/(?P<id>\w+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://webtv.un.org/en/asset/k1o/k1o7stmi6p',
|
||||
@ -22,33 +23,10 @@ class UnitedNationWebTVExtractorIE(KalturaIE):
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
partner_id = self._html_search_regex(
|
||||
r'partnerId:\s*(\w+)',
|
||||
webpage,
|
||||
'partner_id',
|
||||
)
|
||||
r'partnerId:\s*(\d+)', webpage, 'partner_id')
|
||||
entry_id = self._html_search_regex(
|
||||
r'const\s+kentryID\s*=\s*["\'](\w+)["\'];',
|
||||
webpage,
|
||||
'kentry_id',
|
||||
)
|
||||
kaltura_api_response = self._get_video_info(entry_id, partner_id)
|
||||
r'const\s+kentryID\s*=\s*["\'](\w+)["\']', webpage, 'kentry_id')
|
||||
|
||||
try:
|
||||
kaltura_url = kaltura_api_response[1].get('dataUrl', None)
|
||||
except IndexError:
|
||||
return self.url_result(
|
||||
f'kaltura:{partner_id}:{entry_id}',
|
||||
KalturaIE.ie_key(),
|
||||
)
|
||||
|
||||
kaltura_id = self._search_regex(
|
||||
r'http://cdnapi.kaltura.com/p/\w+/sp/\w+/playManifest/entryId/(\w+)/format/url/protocol/http',
|
||||
kaltura_url,
|
||||
'kaltura_id',
|
||||
)
|
||||
|
||||
return self.url_result(
|
||||
f'kaltura:{partner_id}:{kaltura_id}',
|
||||
KalturaIE.ie_key(),
|
||||
)
|
||||
return self.url_result(f'kaltura:{partner_id}:{entry_id}', KalturaIE)
|
Loading…
Reference in New Issue
Block a user