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.

51 lines
1.5 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. clean_html,
  5. determine_ext,
  6. js_to_json,
  7. )
  8. class FKTVIE(InfoExtractor):
  9. IE_NAME = 'fernsehkritik.tv'
  10. _VALID_URL = r'https?://(?:www\.)?fernsehkritik\.tv/folge-(?P<id>[0-9]+)(?:/.*)?'
  11. _TEST = {
  12. 'url': 'http://fernsehkritik.tv/folge-1',
  13. 'md5': '21f0b0c99bce7d5b524eb1b17b1c6d79',
  14. 'info_dict': {
  15. 'id': '1',
  16. 'ext': 'mp4',
  17. 'title': 'Folge 1 vom 10. April 2007',
  18. 'thumbnail': r're:^https?://.*\.jpg$',
  19. },
  20. }
  21. def _real_extract(self, url):
  22. episode = self._match_id(url)
  23. webpage = self._download_webpage(
  24. 'http://fernsehkritik.tv/folge-%s/play' % episode, episode)
  25. title = clean_html(self._html_search_regex(
  26. '<h3>([^<]+)</h3>', webpage, 'title'))
  27. thumbnail = self._search_regex(r'POSTER\s*=\s*"([^"]+)', webpage, 'thumbnail', fatal=False)
  28. sources = self._parse_json(self._search_regex(r'(?s)MEDIA\s*=\s*(\[.+?\]);', webpage, 'media'), episode, js_to_json)
  29. formats = []
  30. for source in sources:
  31. furl = source.get('src')
  32. if furl:
  33. formats.append({
  34. 'url': furl,
  35. 'format_id': determine_ext(furl),
  36. })
  37. self._sort_formats(formats)
  38. return {
  39. 'id': episode,
  40. 'title': title,
  41. 'formats': formats,
  42. 'thumbnail': thumbnail,
  43. }