]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/rtp.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import js_to_json
10 class RTPIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?rtp\.pt/play/p(?P<program_id>[0-9]+)/e(?P<id>[0-9]+)/?'
13 'url': 'http://www.rtp.pt/play/p405/e174042/paixoes-cruzadas',
17 'title': 'Paixões Cruzadas',
18 'description': 'As paixões musicais de António Cartaxo e António Macedo',
19 'thumbnail': 're:^https?://.*\.jpg',
22 'skip_download': True, # RTMP download
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
30 title
= self
._html
_search
_meta
(
31 'twitter:title', webpage
, display_name
='title', fatal
=True)
32 description
= self
._html
_search
_meta
('description', webpage
)
33 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
35 player_config
= self
._search
_regex
(
36 r
'(?s)RTPPLAY\.player\.newPlayer\(\s*(\{.*?\})\s*\)', webpage
, 'player config')
37 config
= json
.loads(js_to_json(player_config
))
39 path
, ext
= config
.get('file').rsplit('.', 1)
41 'app': config
.get('application'),
42 'play_path': '{ext:s}:{path:s}'.format(ext
=ext
, path
=path
),
44 'url': 'rtmp://{streamer:s}/{application:s}'.format(**config
),
45 'rtmp_live': config
.get('live', False),
47 'vcodec': config
.get('type') == 'audio' and 'none' or None,
48 'player_url': 'http://programas.rtp.pt/play/player.swf?v3',
55 'description': description
,
56 'thumbnail': thumbnail
,