]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/sbs.py
1 from .common
import InfoExtractor
8 class SBSIE(InfoExtractor
):
11 https?://(?:www\.)?sbs\.com\.au/(?:
16 )|news/(?:embeds/)?video/
20 # Original URL is handled by the generic IE which finds the iframe:
21 # http://www.sbs.com.au/thefeed/blog/2014/08/21/dingo-conservation
22 'url': 'http://www.sbs.com.au/ondemand/video/single/320403011771/?source=drupal&vertical=thefeed',
23 'md5': '3150cf278965eeabb5b4cea1c963fe0a',
27 'title': 'Dingo Conservation (The Feed)',
28 'description': 'md5:f250a9856fca50d22dec0b5b8015f8a5',
29 'thumbnail': r
're:http://.*\.jpg',
31 'timestamp': 1408613220,
32 'upload_date': '20140821',
36 'url': 'http://www.sbs.com.au/ondemand/video/320403011771/Dingo-Conservation-The-Feed',
37 'only_matching': True,
39 'url': 'http://www.sbs.com.au/news/video/471395907773/The-Feed-July-9',
40 'only_matching': True,
42 'url': 'https://www.sbs.com.au/ondemand/?play=1836638787723',
43 'only_matching': True,
45 'url': 'https://www.sbs.com.au/ondemand/program/inside-windsor-castle?play=1283505731842',
46 'only_matching': True,
48 'url': 'https://www.sbs.com.au/news/embeds/video/1840778819866',
49 'only_matching': True,
51 'url': 'https://www.sbs.com.au/ondemand/watch/1698704451971',
52 'only_matching': True,
54 'url': 'https://www.sbs.com.au/ondemand/movie/coherence/1469404227931',
55 'only_matching': True,
57 'note': 'Live stream',
58 'url': 'https://www.sbs.com.au/ondemand/video/1726824003663/sbs-24x7-live-stream-nsw',
59 'only_matching': True,
62 def _real_extract(self
, url
):
63 video_id
= self
._match
_id
(url
)
64 player_params
= self
._download
_json
(
65 'http://www.sbs.com.au/api/video_pdkvars/id/%s?form=json' % video_id
, video_id
)
67 error
= player_params
.get('error')
69 error_message
= 'Sorry, The video you are looking for does not exist.'
70 video_data
= error
.get('results') or {}
71 error_code
= error
.get('errorCode')
72 if error_code
== 'ComingSoon':
73 error_message
= '%s is not yet available.' % video_data
.get('title', '')
74 elif error_code
in ('Forbidden', 'intranetAccessOnly'):
75 error_message
= 'Sorry, This video cannot be accessed via this website'
76 elif error_code
== 'Expired':
77 error_message
= 'Sorry, %s is no longer available.' % video_data
.get('title', '')
78 raise ExtractorError('%s said: %s' % (self
.IE_NAME
, error_message
), expected
=True)
80 urls
= player_params
['releaseUrls']
81 theplatform_url
= (urls
.get('progressive') or urls
.get('html')
82 or urls
.get('standard') or player_params
['relatedItemsURL'])
85 '_type': 'url_transparent',
86 'ie_key': 'ThePlatform',
88 'url': smuggle_url(self
._proto
_relative
_url
(theplatform_url
), {'force_smil_url': True}
),
89 'is_live': player_params
.get('streamType') == 'live',