]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mpora.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class MporaIE(InfoExtractor
):
11 _VALID_URL
= r
'^https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
15 'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
16 'file': 'AAdo8okx4wiz.mp4',
17 'md5': 'a7a228473eedd3be741397cf452932eb',
19 'title': 'Katy Curd - Winter in the Forest',
21 'uploader': 'Peter Newman Media',
25 def _real_extract(self
, url
):
26 m
= re
.match(self
._VALID
_URL
, url
)
27 video_id
= m
.group('id')
29 webpage
= self
._download
_webpage
(url
, video_id
)
30 data_json
= self
._search
_regex
(
31 r
"new FM\.Player\('[^']+',\s*(\{.*?)\).player;", webpage
, 'json')
33 data
= json
.loads(data_json
)
35 uploader
= data
['info_overlay'].get('username')
36 duration
= data
['video']['duration'] // 1000
37 thumbnail
= data
['video']['encodings']['sd']['poster']
38 title
= data
['info_overlay']['title']
41 for encoding_id
, edata
in data
['video']['encodings'].items():
42 for src
in edata
['sources']:
43 width_str
= self
._search
_regex
(
44 r
'_([0-9]+)\.[a-zA-Z0-9]+$', src
['src'],
46 vcodec
= src
['type'].partition('/')[2]
49 'format_id': encoding_id
+ '-' + vcodec
,
52 'width': int_or_none(width_str
),
55 self
._sort
_formats
(formats
)
63 'thumbnail': thumbnail
,