]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/svtplay.py
433dfd1cb0f27f066e37b26508a97a388d0046d1
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
12 class SVTPlayIE(InfoExtractor
):
13 IE_DESC
= 'SVT Play and Öppet arkiv'
14 _VALID_URL
= r
'https?://(?:www\.)?(?P<host>svtplay|oppetarkiv)\.se/video/(?P<id>[0-9]+)'
16 'url': 'http://www.svtplay.se/video/2609989/sm-veckan/sm-veckan-rally-final-sasong-1-sm-veckan-rally-final',
17 'md5': 'ade3def0643fa1c40587a422f98edfd9',
21 'title': 'SM veckan vinter, Örebro - Rally, final',
23 'thumbnail': 're:^https?://.*[\.-]jpg$',
27 'url': 'http://www.oppetarkiv.se/video/1058509/rederiet-sasong-1-avsnitt-1-av-318',
28 'md5': 'c3101a17ce9634f4c1f9800f0746c187',
32 'title': 'Farlig kryssning',
34 'thumbnail': 're:^https?://.*[\.-]jpg$',
37 'skip': 'Only works from Sweden',
40 def _real_extract(self
, url
):
41 mobj
= re
.match(self
._VALID
_URL
, url
)
42 video_id
= mobj
.group('id')
43 host
= mobj
.group('host')
45 info
= self
._download
_json
(
46 'http://www.%s.se/video/%s?output=json' % (host
, video_id
), video_id
)
48 title
= info
['context']['title']
49 thumbnail
= info
['context'].get('thumbnailImage')
51 video_info
= info
['video']
53 for vr
in video_info
['videoReferences']:
55 ext
= determine_ext(vurl
)
57 formats
.extend(self
._extract
_m
3u8_formats
(
59 ext
='mp4', entry_protocol
='m3u8_native',
60 m3u8_id
=vr
.get('playerType')))
62 formats
.extend(self
._extract
_f
4m
_formats
(
63 vurl
+ '?hdcore=3.3.0', video_id
,
64 f4m_id
=vr
.get('playerType')))
67 'format_id': vr
.get('playerType'),
70 self
._sort
_formats
(formats
)
72 duration
= video_info
.get('materialLength')
73 age_limit
= 18 if video_info
.get('inappropriateForChildren') else 0
79 'thumbnail': thumbnail
,
81 'age_limit': age_limit
,