]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tv2dk.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
16 class TV2DKIE(InfoExtractor
):
33 'url': 'https://www.tvsyd.dk/nyheder/28-10-2019/1930/1930-28-okt-2019?autoplay=1#player',
37 'title': '19:30 - 28. okt. 2019',
38 'timestamp': 1572290248,
39 'upload_date': '20191028',
40 'uploader_id': 'tvsyd',
45 'skip_download': True,
47 'add_ie': ['Kaltura'],
49 'url': 'https://www.tv2ostjylland.dk/artikel/minister-gaar-ind-i-sag-om-diabetes-teknologi',
50 'only_matching': True,
52 'url': 'https://www.tv2ostjylland.dk/nyheder/28-10-2019/22/2200-nyhederne-mandag-d-28-oktober-2019?autoplay=1#player',
53 'only_matching': True,
55 'url': 'https://www.tvmidtvest.dk/nyheder/27-10-2019/1930/1930-27-okt-2019',
56 'only_matching': True,
58 'url': 'https://www.tv2fyn.dk/artikel/fyn-kan-faa-landets-foerste-fabrik-til-groent-jetbraendstof',
59 'only_matching': True,
61 'url': 'https://www.tv2east.dk/artikel/gods-faar-indleveret-tonsvis-af-aebler-100-kilo-aebler-gaar-til-en-aeblebrandy',
62 'only_matching': True,
64 'url': 'https://www.tv2lorry.dk/koebenhavn/rasmus-paludan-evakueret-til-egen-demonstration#player',
65 'only_matching': True,
67 'url': 'https://www.tv2nord.dk/artikel/dybt-uacceptabelt',
68 'only_matching': True,
71 def _real_extract(self
, url
):
72 video_id
= self
._match
_id
(url
)
74 webpage
= self
._download
_webpage
(url
, video_id
)
77 for video_el
in re
.findall(r
'(?s)<[^>]+\bdata-entryid\s*=[^>]*>', webpage
):
78 video
= extract_attributes(video_el
)
79 kaltura_id
= video
.get('data-entryid')
82 partner_id
= video
.get('data-partnerid')
85 entries
.append(self
.url_result(
86 'kaltura:%s:%s' % (partner_id
, kaltura_id
), 'Kaltura',
88 return self
.playlist_result(entries
)
91 class TV2DKBornholmPlayIE(InfoExtractor
):
92 _VALID_URL
= r
'https?://play\.tv2bornholm\.dk/\?.*?\bid=(?P<id>\d+)'
94 'url': 'http://play.tv2bornholm.dk/?area=specifikTV&id=781021',
98 'title': '12Nyheder-27.11.19',
101 'skip_download': True,
105 def _real_extract(self
, url
):
106 video_id
= self
._match
_id
(url
)
108 video
= self
._download
_json
(
109 'http://play.tv2bornholm.dk/controls/AJAX.aspx/specifikVideo', video_id
,
111 'playlist_id': video_id
,
113 }).encode(), headers
={
114 'X-Requested-With': 'XMLHttpRequest',
115 'Content-Type': 'application/json; charset=UTF-8',
118 # TODO: generalize flowplayer
119 title
= self
._search
_regex
(
120 r
'title\s*:\s*(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1', video, 'title
',
122 sources = self._parse_json(self._search_regex(
123 r'(?s
)sources
:\s
*(\
[.+?\
]),', video, 'sources
'),
124 video_id, js_to_json)
128 for source in sources:
129 src = url_or_none(source.get('src
'))
135 ext = determine_ext(src)
136 src_type = source.get('type')
137 if src_type == 'application
/x
-mpegurl
' or ext == 'm3u8
':
138 formats.extend(self._extract_m3u8_formats(
139 src, video_id, ext='mp4
', entry_protocol='m3u8_native
',
140 m3u8_id='hls
', fatal=False))
141 elif src_type == 'application
/dash
+xml
' or ext == 'mpd
':
142 formats.extend(self._extract_mpd_formats(
143 src, video_id, mpd_id='dash
', fatal=False))
148 self._sort_formats(formats)