1 from __future__ import unicode_literals
3 from .common import InfoExtractor
9 class SVTPlayIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?svtplay\.se/video/(?P<id>[0-9]+)'
12 'url': 'http://www.svtplay.se/video/2609989/sm-veckan/sm-veckan-rally-final-sasong-1-sm-veckan-rally-final',
13 'md5': '2521cd644e862936cf2e698206e47385',
17 'title': 'FIFA 14 - E3 2013 Trailer',
19 'thumbnail': 're:^https?://.*\.jpg$',
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25 info = self._download_json(
26 'http://www.svtplay.se/video/%s?output=json' % video_id, video_id)
28 title = info['context']['title']
29 thumbnail = info['context'].get('thumbnailImage')
31 video_info = info['video']
33 for vr in video_info['videoReferences']:
35 if determine_ext(vurl) == 'm3u8':
36 formats.extend(self._extract_m3u8_formats(
38 ext='mp4', entry_protocol='m3u8_native',
39 m3u8_id=vr.get('playerType')))
42 'format_id': vr.get('playerType'),
45 self._sort_formats(formats)
47 duration = video_info.get('materialLength')
53 'thumbnail': thumbnail,