]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mpora.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
12 class MporaIE(InfoExtractor
):
13 _VALID_URL
= r
'^https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
17 'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
18 'file': 'AAdo8okx4wiz.mp4',
19 'md5': 'a7a228473eedd3be741397cf452932eb',
21 'title': 'Katy Curd - Winter in the Forest',
23 'uploader': 'petenewman',
27 def _real_extract(self
, url
):
28 m
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= m
.group('id')
31 webpage
= self
._download
_webpage
(url
, video_id
)
32 data_json
= self
._search
_regex
(
33 r
"new FM\.Player\('[^']+',\s*(\{.*?)\);\n", webpage
, 'json')
35 data
= json
.loads(data_json
)
37 uploader
= data
['info_overlay'].get('username')
38 duration
= data
['video']['duration'] // 1000
39 thumbnail
= data
['video']['encodings']['sd']['poster']
40 title
= data
['info_overlay']['title']
43 for encoding_id
, edata
in data
['video']['encodings'].items():
44 for src
in edata
['sources']:
45 width_str
= self
._search
_regex
(
46 r
'_([0-9]+)\.[a-zA-Z0-9]+$', src
['src'],
48 vcodec
= src
['type'].partition('/')[2]
51 'format_id': encoding_id
+ '-' + vcodec
,
54 'width': int_or_none(width_str
),
57 self
._sort
_formats
(formats
)
65 'thumbnail': thumbnail
,