Skip to content

Commit

Permalink
[ie/NZZ] Fix extractor (yt-dlp#10461)
Browse files Browse the repository at this point in the history
Closes yt-dlp#5653
Authored by: 1-Byte
  • Loading branch information
1-Byte authored Sep 17, 2024
1 parent a06bb58 commit 4a9bc8c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions yt_dlp/extractor/nzz.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import re

from .common import InfoExtractor
from ..utils import (
extract_attributes,
)


class NZZIE(InfoExtractor):
Expand All @@ -22,19 +19,14 @@ class NZZIE(InfoExtractor):
'playlist_count': 1,
}]

def _entries(self, webpage, page_id):
for script in re.findall(r'(?s)<script[^>]* data-hid="jw-video-jw[^>]+>(.+?)</script>', webpage):
settings = self._search_json(r'var\s+settings\s*=[^{]*', script, 'settings', page_id, fatal=False)
if entry := self._parse_jwplayer_data(settings, page_id):
yield entry

def _real_extract(self, url):
page_id = self._match_id(url)
webpage = self._download_webpage(url, page_id)

entries = []
for player_element in re.findall(
r'(<[^>]+class="kalturaPlayer[^"]*"[^>]*>)', webpage):
player_params = extract_attributes(player_element)
if player_params.get('data-type') not in ('kaltura_singleArticle',):
self.report_warning('Unsupported player type')
continue
entry_id = player_params['data-id']
entries.append(self.url_result(
'kaltura:1750922:' + entry_id, 'Kaltura', entry_id))

return self.playlist_result(entries, page_id)
return self.playlist_result(self._entries(webpage, page_id), page_id)

0 comments on commit 4a9bc8c

Please sign in to comment.