mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 20:03:17 +00:00
86e5f3ed2e
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
import re
|
|
|
|
from .common import InfoExtractor
|
|
from ..utils import (
|
|
extract_attributes,
|
|
)
|
|
|
|
|
|
class NZZIE(InfoExtractor):
|
|
_VALID_URL = r'https?://(?:www\.)?nzz\.ch/(?:[^/]+/)*[^/?#]+-ld\.(?P<id>\d+)'
|
|
_TESTS = [{
|
|
'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153',
|
|
'info_dict': {
|
|
'id': '9153',
|
|
},
|
|
'playlist_mincount': 6,
|
|
}, {
|
|
'url': 'https://www.nzz.ch/video/nzz-standpunkte/cvp-auf-der-suche-nach-dem-mass-der-mitte-ld.1368112',
|
|
'info_dict': {
|
|
'id': '1368112',
|
|
},
|
|
'playlist_count': 1,
|
|
}]
|
|
|
|
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)
|