]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/rte.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class RteIE(InfoExtractor
):
14 IE_DESC
= 'Raidió Teilifís Éireann TV'
15 _VALID_URL
= r
'https?://(?:www\.)?rte\.ie/player/[^/]{2,3}/show/[^/]+/(?P<id>[0-9]+)'
17 'url': 'http://www.rte.ie/player/ie/show/iwitness-862/10478715/',
21 'title': 'Watch iWitness online',
22 'thumbnail': 're:^https?://.*\.jpg$',
23 'description': 'iWitness : The spirit of Ireland, one voice and one minute at a time.',
27 'skip_download': 'f4m fails with --test atm'
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 title
= self
._og
_search
_title
(webpage
)
36 description
= self
._html
_search
_meta
('description', webpage
, 'description')
37 duration
= float_or_none(self
._html
_search
_meta
(
38 'duration', webpage
, 'duration', fatal
=False), 1000)
40 thumbnail_id
= self
._search
_regex
(
41 r
'<meta name="thumbnail" content="uri:irus:(.*?)" />', webpage
, 'thumbnail')
42 thumbnail
= 'http://img.rasset.ie/' + thumbnail_id
+ '.jpg'
44 feeds_url
= self
._html
_search
_meta
("feeds-prefix", webpage
, 'feeds url') + video_id
45 json_string
= self
._download
_json
(feeds_url
, video_id
)
47 # f4m_url = server + relative_url
48 f4m_url
= json_string
['shows'][0]['media:group'][0]['rte:server'] + json_string
['shows'][0]['media:group'][0]['url']
49 f4m_formats
= self
._extract
_f
4m
_formats
(f4m_url
, video_id
)
54 'formats': f4m_formats
,
55 'description': description
,
56 'thumbnail': thumbnail
,
61 class RteRadioIE(InfoExtractor
):
63 IE_DESC
= 'Raidió Teilifís Éireann radio'
64 # Radioplayer URLs have the specifier #!rii=<channel_id>:<id>:<playable_item_id>:<date>:
65 # where the IDs are int/empty, the date is DD-MM-YYYY, and the specifier may be truncated.
66 # An <id> uniquely defines an individual recording, and is the only part we require.
67 _VALID_URL
= r
'https?://(?:www\.)?rte\.ie/radio/utils/radioplayer/rteradioweb\.html#!rii=(?:[0-9]*)(?:%3A|:)(?P<id>[0-9]+)'
70 'url': 'http://www.rte.ie/radio/utils/radioplayer/rteradioweb.html#!rii=16:10507902:2414:27-12-2015:',
75 'thumbnail': 're:^https?://.*\.jpg$',
76 'description': 'md5:9ce124a7fb41559ec68f06387cabddf0',
77 'timestamp': 1451203200,
78 'upload_date': '20151227',
82 'skip_download': 'f4m fails with --test atm'
86 def _real_extract(self
, url
):
87 item_id
= self
._match
_id
(url
)
89 json_string
= self
._download
_json
(
90 'http://www.rte.ie/rteavgen/getplaylist/?type=web&format=json&id=' + item_id
,
93 # NB the string values in the JSON are stored using XML escaping(!)
94 show
= json_string
['shows'][0]
95 title
= unescapeHTML(show
['title'])
96 description
= unescapeHTML(show
.get('description'))
97 thumbnail
= show
.get('thumbnail')
98 duration
= float_or_none(show
.get('duration'), 1000)
99 timestamp
= parse_iso8601(show
.get('published'))
101 mg
= show
['media:group'][0]
105 if mg
.get('url') and not mg
['url'].startswith('rtmpe:'):
106 formats
.append({'url': mg['url']}
)
108 if mg
.get('hls_server') and mg
.get('hls_url'):
109 formats
.extend(self
._extract
_m
3u8_formats
(
110 mg
['hls_server'] + mg
['hls_url'], item_id
, 'mp4',
111 entry_protocol
='m3u8_native', m3u8_id
='hls', fatal
=False))
113 if mg
.get('hds_server') and mg
.get('hds_url'):
114 formats
.extend(self
._extract
_f
4m
_formats
(
115 mg
['hds_server'] + mg
['hds_url'], item_id
,
116 f4m_id
='hds', fatal
=False))
118 self
._sort
_formats
(formats
)
123 'description': description
,
124 'thumbnail': thumbnail
,
125 'timestamp': timestamp
,
126 'duration': duration
,