~ubuntu-branches/ubuntu/vivid/youtube-dl/vivid

« back to all changes in this revision

Viewing changes to youtube_dl/extractor/musicvault.py

  • Committer: Package Import Robot
  • Author(s): Rogério Brito
  • Date: 2015-03-01 02:12:13 UTC
  • mfrom: (44.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20150301021213-8w657cue71kp77sz
Tags: 2015.02.28-1
Imported Upstream version 2015.02.28. Closes: #778765.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import re
4
4
 
5
5
from .common import InfoExtractor
6
 
from ..utils import (
7
 
    parse_duration,
8
 
    unified_strdate,
9
 
)
10
6
 
11
7
 
12
8
class MusicVaultIE(InfoExtractor):
13
9
    _VALID_URL = r'https?://www\.musicvault\.com/(?P<uploader_id>[^/?#]*)/video/(?P<display_id>[^/?#]*)_(?P<id>[0-9]+)\.html'
14
10
    _TEST = {
15
11
        'url': 'http://www.musicvault.com/the-allman-brothers-band/video/straight-from-the-heart_1010863.html',
16
 
        'md5': '2cdbb3ae75f7fb3519821507d2fb3c15',
 
12
        'md5': '3adcbdb3dcc02d647539e53f284ba171',
17
13
        'info_dict': {
18
14
            'id': '1010863',
19
15
            'ext': 'mp4',
22
18
            'duration': 244,
23
19
            'uploader': 'The Allman Brothers Band',
24
20
            'thumbnail': 're:^https?://.*/thumbnail/.*',
25
 
            'upload_date': '19811216',
 
21
            'upload_date': '20131219',
26
22
            'location': 'Capitol Theatre (Passaic, NJ)',
27
23
            'description': 'Listen to The Allman Brothers Band perform Straight from the Heart at Capitol Theatre (Passaic, NJ) on Dec 16, 1981',
 
24
            'timestamp': int,
28
25
        }
29
26
    }
30
27
 
43
40
            r'<h1.*?>(.*?)</h1>', data_div, 'uploader', fatal=False)
44
41
        title = self._html_search_regex(
45
42
            r'<h2.*?>(.*?)</h2>', data_div, 'title')
46
 
        upload_date = unified_strdate(self._html_search_regex(
47
 
            r'<h3.*?>(.*?)</h3>', data_div, 'uploader', fatal=False))
48
43
        location = self._html_search_regex(
49
44
            r'<h4.*?>(.*?)</h4>', data_div, 'location', fatal=False)
50
45
 
51
 
        duration = parse_duration(self._html_search_meta('duration', webpage))
52
 
 
53
 
        VIDEO_URL_TEMPLATE = 'http://cdnapi.kaltura.com/p/%(uid)s/sp/%(wid)s/playManifest/entryId/%(entry_id)s/format/url/protocol/http'
54
46
        kaltura_id = self._search_regex(
55
47
            r'<div id="video-detail-player" data-kaltura-id="([^"]+)"',
56
48
            webpage, 'kaltura ID')
57
 
        video_url = VIDEO_URL_TEMPLATE % {
58
 
            'entry_id': kaltura_id,
59
 
            'wid': self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid'),
60
 
            'uid': self._search_regex(r'uiconf_id/([0-9]+)/', webpage, 'uid'),
61
 
        }
 
49
        wid = self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid')
62
50
 
63
51
        return {
64
52
            'id': mobj.group('id'),
65
 
            'url': video_url,
66
 
            'ext': 'mp4',
 
53
            '_type': 'url_transparent',
 
54
            'url': 'kaltura:%s:%s' % (wid, kaltura_id),
 
55
            'ie_key': 'Kaltura',
67
56
            'display_id': display_id,
68
57
            'uploader_id': mobj.group('uploader_id'),
69
58
            'thumbnail': thumbnail,
70
59
            'description': self._html_search_meta('description', webpage),
71
 
            'upload_date': upload_date,
72
60
            'location': location,
73
61
            'title': title,
74
62
            'uploader': uploader,
75
 
            'duration': duration,
76
63
        }