mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 15:25:49 +00:00
[musicvault] Use the Kaltura extractor
This commit is contained in:
parent
0d97ef43be
commit
da419e2332
@ -3,17 +3,13 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
|
||||||
parse_duration,
|
|
||||||
unified_strdate,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MusicVaultIE(InfoExtractor):
|
class MusicVaultIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.musicvault\.com/(?P<uploader_id>[^/?#]*)/video/(?P<display_id>[^/?#]*)_(?P<id>[0-9]+)\.html'
|
_VALID_URL = r'https?://www\.musicvault\.com/(?P<uploader_id>[^/?#]*)/video/(?P<display_id>[^/?#]*)_(?P<id>[0-9]+)\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.musicvault.com/the-allman-brothers-band/video/straight-from-the-heart_1010863.html',
|
'url': 'http://www.musicvault.com/the-allman-brothers-band/video/straight-from-the-heart_1010863.html',
|
||||||
'md5': '2cdbb3ae75f7fb3519821507d2fb3c15',
|
'md5': '3adcbdb3dcc02d647539e53f284ba171',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1010863',
|
'id': '1010863',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -22,9 +18,10 @@ class MusicVaultIE(InfoExtractor):
|
|||||||
'duration': 244,
|
'duration': 244,
|
||||||
'uploader': 'The Allman Brothers Band',
|
'uploader': 'The Allman Brothers Band',
|
||||||
'thumbnail': 're:^https?://.*/thumbnail/.*',
|
'thumbnail': 're:^https?://.*/thumbnail/.*',
|
||||||
'upload_date': '19811216',
|
'upload_date': '20131219',
|
||||||
'location': 'Capitol Theatre (Passaic, NJ)',
|
'location': 'Capitol Theatre (Passaic, NJ)',
|
||||||
'description': 'Listen to The Allman Brothers Band perform Straight from the Heart at Capitol Theatre (Passaic, NJ) on Dec 16, 1981',
|
'description': 'Listen to The Allman Brothers Band perform Straight from the Heart at Capitol Theatre (Passaic, NJ) on Dec 16, 1981',
|
||||||
|
'timestamp': int,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,34 +40,24 @@ def _real_extract(self, url):
|
|||||||
r'<h1.*?>(.*?)</h1>', data_div, 'uploader', fatal=False)
|
r'<h1.*?>(.*?)</h1>', data_div, 'uploader', fatal=False)
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<h2.*?>(.*?)</h2>', data_div, 'title')
|
r'<h2.*?>(.*?)</h2>', data_div, 'title')
|
||||||
upload_date = unified_strdate(self._html_search_regex(
|
|
||||||
r'<h3.*?>(.*?)</h3>', data_div, 'uploader', fatal=False))
|
|
||||||
location = self._html_search_regex(
|
location = self._html_search_regex(
|
||||||
r'<h4.*?>(.*?)</h4>', data_div, 'location', fatal=False)
|
r'<h4.*?>(.*?)</h4>', data_div, 'location', fatal=False)
|
||||||
|
|
||||||
duration = parse_duration(self._html_search_meta('duration', webpage))
|
|
||||||
|
|
||||||
VIDEO_URL_TEMPLATE = 'http://cdnapi.kaltura.com/p/%(uid)s/sp/%(wid)s/playManifest/entryId/%(entry_id)s/format/url/protocol/http'
|
|
||||||
kaltura_id = self._search_regex(
|
kaltura_id = self._search_regex(
|
||||||
r'<div id="video-detail-player" data-kaltura-id="([^"]+)"',
|
r'<div id="video-detail-player" data-kaltura-id="([^"]+)"',
|
||||||
webpage, 'kaltura ID')
|
webpage, 'kaltura ID')
|
||||||
video_url = VIDEO_URL_TEMPLATE % {
|
wid = self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid')
|
||||||
'entry_id': kaltura_id,
|
|
||||||
'wid': self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid'),
|
|
||||||
'uid': self._search_regex(r'uiconf_id/([0-9]+)/', webpage, 'uid'),
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': mobj.group('id'),
|
'id': mobj.group('id'),
|
||||||
'url': video_url,
|
'_type': 'url_transparent',
|
||||||
'ext': 'mp4',
|
'url': 'kaltura:%s:%s' % (wid, kaltura_id),
|
||||||
|
'ie_key': 'Kaltura',
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'uploader_id': mobj.group('uploader_id'),
|
'uploader_id': mobj.group('uploader_id'),
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'description': self._html_search_meta('description', webpage),
|
'description': self._html_search_meta('description', webpage),
|
||||||
'upload_date': upload_date,
|
|
||||||
'location': location,
|
'location': location,
|
||||||
'title': title,
|
'title': title,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'duration': duration,
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user