You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. extract_attributes,
  7. )
  8. class NZZIE(InfoExtractor):
  9. _VALID_URL = r'https?://(?:www\.)?nzz\.ch/(?:[^/]+/)*[^/?#]+-ld\.(?P<id>\d+)'
  10. _TEST = {
  11. 'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153',
  12. 'info_dict': {
  13. 'id': '9153',
  14. },
  15. 'playlist_mincount': 6,
  16. }
  17. def _real_extract(self, url):
  18. page_id = self._match_id(url)
  19. webpage = self._download_webpage(url, page_id)
  20. entries = []
  21. for player_element in re.findall(r'(<[^>]+class="kalturaPlayer"[^>]*>)', webpage):
  22. player_params = extract_attributes(player_element)
  23. if player_params.get('data-type') not in ('kaltura_singleArticle',):
  24. self.report_warning('Unsupported player type')
  25. continue
  26. entry_id = player_params['data-id']
  27. entries.append(self.url_result(
  28. 'kaltura:1750922:' + entry_id, 'Kaltura', entry_id))
  29. return self.playlist_result(entries, page_id)