class SVTBaseIE(InfoExtractor):
+ _GEO_COUNTRIES = ['SE']
+
def _extract_video(self, video_info, video_id):
formats = []
for vr in video_info['videoReferences']:
- player_type = vr.get('playerType')
+ player_type = vr.get('playerType') or vr.get('format')
vurl = vr['url']
ext = determine_ext(vurl)
if ext == 'm3u8':
'url': vurl,
})
if not formats and video_info.get('rights', {}).get('geoBlockedSweden'):
- self.raise_geo_restricted('This video is only available in Sweden')
+ self.raise_geo_restricted(
+ 'This video is only available in Sweden',
+ countries=self._GEO_COUNTRIES)
self._sort_formats(formats)
subtitles = {}
class SVTPlayIE(SVTBaseIE):
IE_DESC = 'SVT Play and Öppet arkiv'
- _VALID_URL = r'https?://(?:www\.)?(?:svtplay|oppetarkiv)\.se/video/(?P<id>[0-9]+)'
+ _VALID_URL = r'https?://(?:www\.)?(?:svtplay|oppetarkiv)\.se/(?:video|klipp)/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://www.svtplay.se/video/5996901/flygplan-till-haile-selassie/flygplan-till-haile-selassie-2',
'md5': '2b6704fe4a28801e1a098bbf3c5ac611',
'ext': 'mp4',
'title': 'Flygplan till Haile Selassie',
'duration': 3527,
- 'thumbnail': 're:^https?://.*[\.-]jpg$',
+ 'thumbnail': r're:^https?://.*[\.-]jpg$',
'age_limit': 0,
'subtitles': {
'sv': [{
# geo restricted to Sweden
'url': 'http://www.oppetarkiv.se/video/5219710/trollflojten',
'only_matching': True,
+ }, {
+ 'url': 'http://www.svtplay.se/klipp/9023742/stopptid-om-bjorn-borg',
+ 'only_matching': True,
}]
def _real_extract(self, url):