mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 04:02:11 +00:00
[kaltura] Strictify _VALID_URL
This commit is contained in:
parent
ef49b59053
commit
ee3ec091f4
1 changed files with 22 additions and 10 deletions
|
@ -13,13 +13,25 @@ from ..utils import (
|
||||||
|
|
||||||
class KalturaIE(InfoExtractor):
|
class KalturaIE(InfoExtractor):
|
||||||
_VALID_URL = r'''(?x)
|
_VALID_URL = r'''(?x)
|
||||||
(?:kaltura:|
|
(?:
|
||||||
https?://(:?(?:www|cdnapisec)\.)?kaltura\.com/(?:
|
kaltura:(?P<partner_id_s>\d+):(?P<id_s>[0-9a-z_]+)|
|
||||||
(?:index\.php/kwidget/(?:[^/]+/)*?wid/_)|
|
https?://
|
||||||
(?:html5/html5lib/v(?:[\d.]+)/mwEmbedFrame.php/p/\d+)
|
(:?
|
||||||
)
|
(?:www|cdnapisec)\.)?kaltura\.com/
|
||||||
)(?P<partner_id>\d+)?(?::|/(?:[^/]+/)*?entry_id/)(?P<id>[0-9a-z_]+)
|
(?:
|
||||||
(?:\?wid=_(?P<partner_id_html5>\d+))?'''
|
(?:
|
||||||
|
# flash player
|
||||||
|
index\.php/kwidget/
|
||||||
|
(?:[^/]+/)*?wid/_(?P<partner_id>\d+)/
|
||||||
|
(?:[^/]+/)*?entry_id/(?P<id>[0-9a-z_]+)|
|
||||||
|
# html player
|
||||||
|
html5/html5lib/
|
||||||
|
(?:[^/]+/)*?entry_id/(?P<id_html5>[0-9a-z_]+)
|
||||||
|
.*\?.*\bwid=_(?P<partner_id_html5>\d+)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'''
|
||||||
_API_BASE = 'http://cdnapi.kaltura.com/api_v3/index.php?'
|
_API_BASE = 'http://cdnapi.kaltura.com/api_v3/index.php?'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
|
@ -110,9 +122,9 @@ class KalturaIE(InfoExtractor):
|
||||||
video_id, actions, note='Downloading video info JSON')
|
video_id, actions, note='Downloading video info JSON')
|
||||||
|
|
||||||
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)
|
||||||
partner_id, entry_id = mobj.group('partner_id') or mobj.group('partner_id_html5'), mobj.group('id')
|
partner_id = mobj.group('partner_id_s') or mobj.group('partner_id') or mobj.group('partner_id_html5')
|
||||||
|
entry_id = mobj.group('id_s') or mobj.group('id') or mobj.group('id_html5')
|
||||||
|
|
||||||
info, source_data = self._get_video_info(entry_id, partner_id)
|
info, source_data = self._get_video_info(entry_id, partner_id)
|
||||||
|
|
||||||
|
@ -131,7 +143,7 @@ class KalturaIE(InfoExtractor):
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': entry_id,
|
||||||
'title': info['name'],
|
'title': info['name'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'description': info.get('description'),
|
'description': info.get('description'),
|
||||||
|
|
Loading…
Reference in a new issue