]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rte.py
a6fac6c35d00327c2858f9aead301845c4af572a
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_HTTPError
16 class RteBaseIE(InfoExtractor
):
17 def _real_extract(self
, url
):
18 item_id
= self
._match
_id
(url
)
21 json_string
= self
._download
_json
(
22 'http://www.rte.ie/rteavgen/getplaylist/?type=web&format=json&id=' + item_id
,
24 except ExtractorError
as ee
:
25 if isinstance(ee
.cause
, compat_HTTPError
) and ee
.cause
.code
== 404:
26 error_info
= self
._parse
_json
(ee
.cause
.read().decode(), item_id
, fatal
=False)
29 '%s said: %s' % (self
.IE_NAME
, error_info
['message']),
33 # NB the string values in the JSON are stored using XML escaping(!)
34 show
= json_string
['shows'][0]
35 title
= unescapeHTML(show
['title'])
36 description
= unescapeHTML(show
.get('description'))
37 thumbnail
= show
.get('thumbnail')
38 duration
= float_or_none(show
.get('duration'), 1000)
39 timestamp
= parse_iso8601(show
.get('published'))
41 mg
= show
['media:group'][0]
46 m
= re
.match(r
'(?P<url>rtmpe?://[^/]+)/(?P<app>.+)/(?P<playpath>mp4:.*)', mg
['url'])
50 'url': m
['url'] + '/' + m
['app'],
52 'play_path': m
['playpath'],
58 if mg
.get('hls_server') and mg
.get('hls_url'):
59 formats
.extend(self
._extract
_m
3u8_formats
(
60 mg
['hls_server'] + mg
['hls_url'], item_id
, 'mp4',
61 entry_protocol
='m3u8_native', m3u8_id
='hls', fatal
=False))
63 if mg
.get('hds_server') and mg
.get('hds_url'):
64 formats
.extend(self
._extract
_f
4m
_formats
(
65 mg
['hds_server'] + mg
['hds_url'], item_id
,
66 f4m_id
='hds', fatal
=False))
68 self
._sort
_formats
(formats
)
73 'description': description
,
74 'thumbnail': thumbnail
,
75 'timestamp': timestamp
,
81 class RteIE(RteBaseIE
):
83 IE_DESC
= 'Raidió Teilifís Éireann TV'
84 _VALID_URL
= r
'https?://(?:www\.)?rte\.ie/player/[^/]{2,3}/show/[^/]+/(?P<id>[0-9]+)'
86 'url': 'http://www.rte.ie/player/ie/show/iwitness-862/10478715/',
87 'md5': '4a76eb3396d98f697e6e8110563d2604',
92 'thumbnail': r
're:^https?://.*\.jpg$',
93 'description': 'The spirit of Ireland, one voice and one minute at a time.',
95 'upload_date': '20151012',
96 'timestamp': 1444694160,
101 class RteRadioIE(RteBaseIE
):
102 IE_NAME
= 'rte:radio'
103 IE_DESC
= 'Raidió Teilifís Éireann radio'
104 # Radioplayer URLs have two distinct specifier formats,
105 # the old format #!rii=<channel_id>:<id>:<playable_item_id>:<date>:
106 # the new format #!rii=b<channel_id>_<id>_<playable_item_id>_<date>_
107 # where the IDs are int/empty, the date is DD-MM-YYYY, and the specifier may be truncated.
108 # An <id> uniquely defines an individual recording, and is the only part we require.
109 _VALID_URL
= r
'https?://(?:www\.)?rte\.ie/radio/utils/radioplayer/rteradioweb\.html#!rii=(?:b?[0-9]*)(?:%3A|:|%5F|_)(?P<id>[0-9]+)'
112 # Old-style player URL; HLS and RTMPE formats
113 'url': 'http://www.rte.ie/radio/utils/radioplayer/rteradioweb.html#!rii=16:10507902:2414:27-12-2015:',
114 'md5': 'c79ccb2c195998440065456b69760411',
119 'thumbnail': r
're:^https?://.*\.jpg$',
120 'description': 'md5:9ce124a7fb41559ec68f06387cabddf0',
121 'timestamp': 1451203200,
122 'upload_date': '20151227',
126 # New-style player URL; RTMPE formats only
127 'url': 'http://rte.ie/radio/utils/radioplayer/rteradioweb.html#!rii=b16_3250678_8861_06-04-2012_',
131 'title': 'The Lyric Concert with Paul Herriott',
132 'thumbnail': r
're:^https?://.*\.jpg$',
134 'timestamp': 1333742400,
135 'upload_date': '20120406',
136 'duration': 7199.016,
140 'skip_download': True,