]>
Commit | Line | Data |
---|---|---|
2ef6fcb5 PH |
1 | # -*- coding: utf-8 -*- |
2 | from __future__ import unicode_literals | |
3 | ||
2ef6fcb5 | 4 | from .common import InfoExtractor |
2ef6fcb5 PH |
5 | |
6 | ||
7 | class SBSIE(InfoExtractor): | |
8 | IE_DESC = 'sbs.com.au' | |
3c283a38 | 9 | _VALID_URL = r'https?://(?:www\.)?sbs\.com\.au/(?:ondemand|news)/video/(?:single/)?(?P<id>[0-9]+)' |
2ef6fcb5 PH |
10 | |
11 | _TESTS = [{ | |
12 | # Original URL is handled by the generic IE which finds the iframe: | |
13 | # http://www.sbs.com.au/thefeed/blog/2014/08/21/dingo-conservation | |
14 | 'url': 'http://www.sbs.com.au/ondemand/video/single/320403011771/?source=drupal&vertical=thefeed', | |
15 | 'md5': '3150cf278965eeabb5b4cea1c963fe0a', | |
16 | 'info_dict': { | |
17 | 'id': '320403011771', | |
e35cb78c | 18 | 'ext': 'mp4', |
3c283a38 S |
19 | 'title': 'Dingo Conservation (The Feed)', |
20 | 'description': 'md5:f250a9856fca50d22dec0b5b8015f8a5', | |
2ef6fcb5 | 21 | 'thumbnail': 're:http://.*\.jpg', |
3c283a38 | 22 | 'duration': 308, |
2ef6fcb5 | 23 | }, |
9e1a5b84 | 24 | }, { |
63cddb64 JMF |
25 | 'url': 'http://www.sbs.com.au/ondemand/video/320403011771/Dingo-Conservation-The-Feed', |
26 | 'only_matching': True, | |
3c283a38 S |
27 | }, { |
28 | 'url': 'http://www.sbs.com.au/news/video/471395907773/The-Feed-July-9', | |
29 | 'only_matching': True, | |
2ef6fcb5 PH |
30 | }] |
31 | ||
32 | def _real_extract(self, url): | |
ef2dcbe4 S |
33 | video_id = self._match_id(url) |
34 | ||
3c283a38 S |
35 | webpage = self._download_webpage( |
36 | 'http://www.sbs.com.au/ondemand/video/single/%s?context=web' % video_id, video_id) | |
ef2dcbe4 | 37 | |
3c283a38 S |
38 | player_params = self._parse_json( |
39 | self._search_regex( | |
40 | r'(?s)var\s+playerParams\s*=\s*({.+?});', webpage, 'playerParams'), | |
41 | video_id) | |
2ef6fcb5 | 42 | |
3c283a38 S |
43 | urls = player_params['releaseUrls'] |
44 | theplatform_url = (urls.get('progressive') or urls.get('standard') or | |
45 | urls.get('html') or player_params['relatedItemsURL']) | |
2ef6fcb5 PH |
46 | |
47 | return { | |
48 | '_type': 'url_transparent', | |
49 | 'id': video_id, | |
50 | 'url': theplatform_url, | |
2ef6fcb5 | 51 | } |