4 from .common
import InfoExtractor
13 class TV2DKIE(InfoExtractor
):
30 'url': 'https://www.tvsyd.dk/nyheder/28-10-2019/1930/1930-28-okt-2019?autoplay=1#player',
34 'title': '19:30 - 28. okt. 2019',
35 'timestamp': 1572290248,
36 'upload_date': '20191028',
37 'uploader_id': 'tvsyd',
41 'add_ie': ['Kaltura'],
43 'url': 'https://www.tv2lorry.dk/gadekamp/gadekamp-6-hoejhuse-i-koebenhavn',
47 'upload_date': '20211027',
48 'title': 'Gadekamp #6 - Højhuse i København',
49 'uploader_id': 'tv2lorry',
50 'timestamp': 1635345229,
52 'add_ie': ['Kaltura'],
54 'url': 'https://www.tv2ostjylland.dk/artikel/minister-gaar-ind-i-sag-om-diabetes-teknologi',
55 'only_matching': True,
57 'url': 'https://www.tv2ostjylland.dk/nyheder/28-10-2019/22/2200-nyhederne-mandag-d-28-oktober-2019?autoplay=1#player',
58 'only_matching': True,
60 'url': 'https://www.tvmidtvest.dk/nyheder/27-10-2019/1930/1930-27-okt-2019',
61 'only_matching': True,
63 'url': 'https://www.tv2fyn.dk/artikel/fyn-kan-faa-landets-foerste-fabrik-til-groent-jetbraendstof',
64 'only_matching': True,
66 'url': 'https://www.tv2east.dk/artikel/gods-faar-indleveret-tonsvis-af-aebler-100-kilo-aebler-gaar-til-en-aeblebrandy',
67 'only_matching': True,
69 'url': 'https://www.tv2lorry.dk/koebenhavn/rasmus-paludan-evakueret-til-egen-demonstration#player',
70 'only_matching': True,
72 'url': 'https://www.tv2nord.dk/artikel/dybt-uacceptabelt',
73 'only_matching': True,
76 def _real_extract(self
, url
):
77 video_id
= self
._match
_id
(url
)
79 webpage
= self
._download
_webpage
(url
, video_id
)
83 def add_entry(partner_id
, kaltura_id
):
84 entries
.append(self
.url_result(
85 f
'kaltura:{partner_id}:{kaltura_id}', 'Kaltura',
88 for video_el
in re
.findall(r
'(?s)<[^>]+\bdata-entryid\s*=[^>]*>', webpage
):
89 video
= extract_attributes(video_el
)
90 kaltura_id
= video
.get('data-entryid')
93 partner_id
= video
.get('data-partnerid')
96 add_entry(partner_id
, kaltura_id
)
98 kaltura_id
= self
._search
_regex
(
99 (r
'entry_id\s*:\s*["\']([0-9a
-z_
]+)',
100 r'\\u002FentryId
\\u002F(\w
+)\\u002F
'), webpage, 'kaltura
id')
101 partner_id = self._search_regex(
102 (r'\\u002Fp
\\u002F(\d
+)\\u002F
', r'/p
/(\d
+)/'), webpage,
104 add_entry(partner_id, kaltura_id)
105 if len(entries) == 1:
107 return self.playlist_result(entries)
110 class TV2DKBornholmPlayIE(InfoExtractor):
111 _VALID_URL = r'https?
://play\
.tv2bornholm\
.dk
/\?.*?
\bid
=(?P
<id>\d
+)'
113 'url
': 'http
://play
.tv2bornholm
.dk
/?area
=specifikTV
&id=781021',
117 'title
': '12Nyheder
-27.11.19',
120 'skip_download
': True,
124 def _real_extract(self, url):
125 video_id = self._match_id(url)
127 video = self._download_json(
128 'https
://play
.tv2bornholm
.dk
/controls
/AJAX
.aspx
/specifikVideo
', video_id,
130 'playlist_id
': video_id,
132 }).encode(), headers={
133 'X
-Requested
-With
': 'XMLHttpRequest
',
134 'Content
-Type
': 'application
/json
; charset
=UTF
-8',
137 # TODO: generalize flowplayer
138 title = self._search_regex(
139 r'title\s
*:\s
*(["\'])(?P<value>(?:(?!\1).)+)\1', video, 'title',
141 sources = self._parse_json(self._search_regex(
142 r'(?s)sources:\s*(\[.+?\]),', video, 'sources'),
143 video_id, js_to_json)
147 for source in sources:
148 src = url_or_none(source.get('src'))
154 ext = determine_ext(src)
155 src_type = source.get('type')
156 if src_type == 'application/x-mpegurl' or ext == 'm3u8':
157 formats.extend(self._extract_m3u8_formats(
158 src, video_id, ext='mp4', entry_protocol='m3u8_native',
159 m3u8_id='hls', fatal=False))
160 elif src_type == 'application/dash+xml' or ext == 'mpd':
161 formats.extend(self._extract_mpd_formats(
162 src, video_id, mpd_id='dash', fatal=False))