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.

49 lines
1.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .jwplatform import JWPlatformBaseIE
  4. from ..utils import (
  5. clean_html,
  6. get_element_by_class,
  7. js_to_json,
  8. )
  9. class TVNoeIE(JWPlatformBaseIE):
  10. _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)'
  11. _TEST = {
  12. 'url': 'http://www.tvnoe.cz/video/10362',
  13. 'md5': 'aee983f279aab96ec45ab6e2abb3c2ca',
  14. 'info_dict': {
  15. 'id': '10362',
  16. 'ext': 'mp4',
  17. 'series': 'Noční univerzita',
  18. 'title': 'prof. Tomáš Halík, Th.D. - Návrat náboženství a střet civilizací',
  19. 'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
  20. }
  21. }
  22. def _real_extract(self, url):
  23. video_id = self._match_id(url)
  24. webpage = self._download_webpage(url, video_id)
  25. iframe_url = self._search_regex(
  26. r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe URL')
  27. ifs_page = self._download_webpage(iframe_url, video_id)
  28. jwplayer_data = self._parse_json(
  29. self._find_jwplayer_data(ifs_page),
  30. video_id, transform_source=js_to_json)
  31. info_dict = self._parse_jwplayer_data(
  32. jwplayer_data, video_id, require_title=False, base_url=iframe_url)
  33. info_dict.update({
  34. 'id': video_id,
  35. 'title': clean_html(get_element_by_class(
  36. 'field-name-field-podnazev', webpage)),
  37. 'description': clean_html(get_element_by_class(
  38. 'field-name-body', webpage)),
  39. 'series': clean_html(get_element_by_class('title', webpage))
  40. })
  41. return info_dict