]>
Commit | Line | Data |
---|---|---|
da9ec3b9 PH |
1 | from __future__ import unicode_literals |
2 | ||
da9ec3b9 PH |
3 | import re |
4 | ||
5 | from .common import InfoExtractor | |
da9ec3b9 PH |
6 | |
7 | ||
8 | class MusicVaultIE(InfoExtractor): | |
9 | _VALID_URL = r'https?://www\.musicvault\.com/(?P<uploader_id>[^/?#]*)/video/(?P<display_id>[^/?#]*)_(?P<id>[0-9]+)\.html' | |
10 | _TEST = { | |
11 | 'url': 'http://www.musicvault.com/the-allman-brothers-band/video/straight-from-the-heart_1010863.html', | |
da419e23 | 12 | 'md5': '3adcbdb3dcc02d647539e53f284ba171', |
da9ec3b9 PH |
13 | 'info_dict': { |
14 | 'id': '1010863', | |
15 | 'ext': 'mp4', | |
16 | 'uploader_id': 'the-allman-brothers-band', | |
17 | 'title': 'Straight from the Heart', | |
18 | 'duration': 244, | |
19 | 'uploader': 'The Allman Brothers Band', | |
20 | 'thumbnail': 're:^https?://.*/thumbnail/.*', | |
da419e23 | 21 | 'upload_date': '20131219', |
da9ec3b9 PH |
22 | 'location': 'Capitol Theatre (Passaic, NJ)', |
23 | 'description': 'Listen to The Allman Brothers Band perform Straight from the Heart at Capitol Theatre (Passaic, NJ) on Dec 16, 1981', | |
da419e23 | 24 | 'timestamp': int, |
da9ec3b9 PH |
25 | } |
26 | } | |
27 | ||
28 | def _real_extract(self, url): | |
29 | mobj = re.match(self._VALID_URL, url) | |
30 | display_id = mobj.group('display_id') | |
31 | webpage = self._download_webpage(url, display_id) | |
32 | ||
33 | thumbnail = self._search_regex( | |
34 | r'<meta itemprop="thumbnail" content="([^"]+)"', | |
35 | webpage, 'thumbnail', fatal=False) | |
36 | ||
37 | data_div = self._search_regex( | |
38 | r'(?s)<div class="data">(.*?)</div>', webpage, 'data fields') | |
39 | uploader = self._html_search_regex( | |
40 | r'<h1.*?>(.*?)</h1>', data_div, 'uploader', fatal=False) | |
41 | title = self._html_search_regex( | |
42 | r'<h2.*?>(.*?)</h2>', data_div, 'title') | |
da9ec3b9 PH |
43 | location = self._html_search_regex( |
44 | r'<h4.*?>(.*?)</h4>', data_div, 'location', fatal=False) | |
45 | ||
da9ec3b9 PH |
46 | kaltura_id = self._search_regex( |
47 | r'<div id="video-detail-player" data-kaltura-id="([^"]+)"', | |
48 | webpage, 'kaltura ID') | |
da419e23 | 49 | wid = self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid') |
da9ec3b9 PH |
50 | |
51 | return { | |
52 | 'id': mobj.group('id'), | |
da419e23 NJ |
53 | '_type': 'url_transparent', |
54 | 'url': 'kaltura:%s:%s' % (wid, kaltura_id), | |
55 | 'ie_key': 'Kaltura', | |
da9ec3b9 PH |
56 | 'display_id': display_id, |
57 | 'uploader_id': mobj.group('uploader_id'), | |
58 | 'thumbnail': thumbnail, | |
59 | 'description': self._html_search_meta('description', webpage), | |
da9ec3b9 PH |
60 | 'location': location, |
61 | 'title': title, | |
62 | 'uploader': uploader, | |
da9ec3b9 | 63 | } |