]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sportdeutschland.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class SportDeutschlandIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://sportdeutschland\.tv/(?P<sport>[^/?#]+)/(?P<id>[^?#/]+)(?:$|[?#])'
16 'url': 'https://sportdeutschland.tv/badminton/re-live-deutsche-meisterschaften-2020-halbfinals?playlistId=0',
18 'id': 're-live-deutsche-meisterschaften-2020-halbfinals',
20 'title': 're:Re-live: Deutsche Meisterschaften 2020.*Halbfinals',
21 'categories': ['Badminton-Deutschland'],
23 'thumbnail': r
're:^https?://.*\.(?:jpg|png)$',
25 'upload_date': '20200201',
26 'description': 're:.*', # meaningless description for THIS video
30 def _real_extract(self
, url
):
31 mobj
= re
.match(self
._VALID
_URL
, url
)
32 video_id
= mobj
.group('id')
33 sport_id
= mobj
.group('sport')
35 api_url
= 'https://proxy.vidibusdynamic.net/ssl/backend.sportdeutschland.tv/api/permalinks/%s/%s?access_token=true' % (
37 req
= sanitized_Request(api_url
, headers
={
38 'Accept': 'application/vnd.vidibus.v2.html+json',
41 data
= self
._download
_json
(req
, video_id
)
44 categories
= [data
['section']['title']]
47 smil_url
= asset
['video']
48 if '.smil' in smil_url
:
49 m3u8_url
= smil_url
.replace('.smil', '.m3u8')
51 self
._extract
_m
3u8_formats
(m3u8_url
, video_id
, ext
='mp4'))
53 smil_doc
= self
._download
_xml
(
54 smil_url
, video_id
, note
='Downloading SMIL metadata')
55 base_url_el
= smil_doc
.find('./head/meta')
57 base_url
= base_url_el
.attrib
['base']
60 'url': base_url
if base_url_el
else n
.attrib
['src'],
61 'play_path': n
.attrib
['src'],
64 'format_note': 'Seems to fail at example stream',
65 } for n
in smil_doc
.findall('./body/video')])
67 formats
.append({'url': smil_url
})
69 self
._sort
_formats
(formats
)
74 'title': asset
['title'],
75 'thumbnail': asset
.get('image'),
76 'description': asset
.get('teaser'),
77 'duration': asset
.get('duration'),
78 'categories': categories
,
79 'view_count': asset
.get('views'),
80 'rtmp_live': asset
.get('live'),
81 'timestamp': parse_iso8601(asset
.get('date')),