diff options
Diffstat (limited to 'yt_dlp')
-rw-r--r-- | yt_dlp/extractor/nzz.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/yt_dlp/extractor/nzz.py b/yt_dlp/extractor/nzz.py index ac3b73156..047c4e1ac 100644 --- a/yt_dlp/extractor/nzz.py +++ b/yt_dlp/extractor/nzz.py | |||
@@ -1,9 +1,6 @@ | |||
1 | import re | 1 | import re |
2 | 2 | ||
3 | from .common import InfoExtractor | 3 | from .common import InfoExtractor |
4 | from ..utils import ( | ||
5 | extract_attributes, | ||
6 | ) | ||
7 | 4 | ||
8 | 5 | ||
9 | class NZZIE(InfoExtractor): | 6 | class NZZIE(InfoExtractor): |
@@ -22,19 +19,14 @@ class NZZIE(InfoExtractor): | |||
22 | 'playlist_count': 1, | 19 | 'playlist_count': 1, |
23 | }] | 20 | }] |
24 | 21 | ||
22 | def _entries(self, webpage, page_id): | ||
23 | for script in re.findall(r'(?s)<script[^>]* data-hid="jw-video-jw[^>]+>(.+?)</script>', webpage): | ||
24 | settings = self._search_json(r'var\s+settings\s*=[^{]*', script, 'settings', page_id, fatal=False) | ||
25 | if entry := self._parse_jwplayer_data(settings, page_id): | ||
26 | yield entry | ||
27 | |||
25 | def _real_extract(self, url): | 28 | def _real_extract(self, url): |
26 | page_id = self._match_id(url) | 29 | page_id = self._match_id(url) |
27 | webpage = self._download_webpage(url, page_id) | 30 | webpage = self._download_webpage(url, page_id) |
28 | 31 | ||
29 | entries = [] | 32 | return self.playlist_result(self._entries(webpage, page_id), page_id) |
30 | for player_element in re.findall( | ||
31 | r'(<[^>]+class="kalturaPlayer[^"]*"[^>]*>)', webpage): | ||
32 | player_params = extract_attributes(player_element) | ||
33 | if player_params.get('data-type') not in ('kaltura_singleArticle',): | ||
34 | self.report_warning('Unsupported player type') | ||
35 | continue | ||
36 | entry_id = player_params['data-id'] | ||
37 | entries.append(self.url_result( | ||
38 | 'kaltura:1750922:' + entry_id, 'Kaltura', entry_id)) | ||
39 | |||
40 | return self.playlist_result(entries, page_id) | ||