]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mpora.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..utils
import int_or_none
7 class MporaIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
12 'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
13 'md5': 'a7a228473eedd3be741397cf452932eb',
17 'title': 'Katy Curd - Winter in the Forest',
19 'uploader': 'Peter Newman Media',
23 def _real_extract(self
, url
):
24 video_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, video_id
)
27 data_json
= self
._search
_regex
(
28 r
"new FM\.Player\('[^']+',\s*(\{.*?)\).player;", webpage
, 'json')
29 data
= self
._parse
_json
(data_json
, video_id
)
31 uploader
= data
['info_overlay'].get('username')
32 duration
= data
['video']['duration'] // 1000
33 thumbnail
= data
['video']['encodings']['sd']['poster']
34 title
= data
['info_overlay']['title']
37 for encoding_id
, edata
in data
['video']['encodings'].items():
38 for src
in edata
['sources']:
39 width_str
= self
._search
_regex
(
40 r
'_([0-9]+)\.[a-zA-Z0-9]+$', src
['src'],
42 vcodec
= src
['type'].partition('/')[2]
45 'format_id': encoding_id
+ '-' + vcodec
,
48 'width': int_or_none(width_str
),
51 self
._sort
_formats
(formats
)
59 'thumbnail': thumbnail
,