[azmedien] Simplify (closes #17746)

This commit is contained in:
Sergey M․ 2018-11-03 01:32:29 +07:00
parent da56fb631f
commit 573531dcfb
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -8,16 +8,7 @@
from .kaltura import KalturaIE from .kaltura import KalturaIE
class AZMedienBaseIE(InfoExtractor): class AZMedienIE(InfoExtractor):
_PARTNER_ID = '1719221'
def _kaltura_video(self, partner_id, entry_id):
return self.url_result(
'kaltura:%s:%s' % (partner_id, entry_id), ie=KalturaIE.ie_key(),
video_id=entry_id)
class AZMedienIE(AZMedienBaseIE):
IE_DESC = 'AZ Medien videos' IE_DESC = 'AZ Medien videos'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
https?:// https?://
@ -58,9 +49,11 @@ class AZMedienIE(AZMedienBaseIE):
'only_matching': True 'only_matching': True
}] }]
_PARTNER_ID = '1719221'
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url)
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
entry_id = mobj.group('kaltura_id') entry_id = mobj.group('kaltura_id')
if not entry_id: if not entry_id:
@ -92,4 +85,6 @@ def _real_extract(self, url):
data=json.dumps(payload).encode()) data=json.dumps(payload).encode())
entry_id = json_data['data']['article']['mainAssetRelation']['asset']['kalturaId'] entry_id = json_data['data']['article']['mainAssetRelation']['asset']['kalturaId']
return self._kaltura_video(self._PARTNER_ID, entry_id) return self.url_result(
'kaltura:%s:%s' % (self._PARTNER_ID, entry_id),
ie=KalturaIE.ie_key(), video_id=entry_id)