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.

43 lines
1.6 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import json
  4. from .common import InfoExtractor
  5. from ..utils import js_to_json
  6. class SRMediathekIE(InfoExtractor):
  7. IE_DESC = 'Saarländischer Rundfunk'
  8. _VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
  9. _TEST = {
  10. 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
  11. 'info_dict': {
  12. 'id': '28455',
  13. 'ext': 'mp4',
  14. 'title': 'sportarena (26.10.2014)',
  15. 'description': 'Ringen: KSV Köllerbach gegen Aachen-Walheim; Frauen-Fußball: 1. FC Saarbrücken gegen Sindelfingen; Motorsport: Rallye in Losheim; dazu: Interview mit Timo Bernhard; Turnen: TG Saar; Reitsport: Deutscher Voltigier-Pokal; Badminton: Interview mit Michael Fuchs ',
  16. 'thumbnail': 're:^https?://.*\.jpg$',
  17. },
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. murls = json.loads(js_to_json(self._search_regex(
  23. r'var mediaURLs\s*=\s*(.*?);\n', webpage, 'video URLs')))
  24. formats = [{'url': murl} for murl in murls]
  25. self._sort_formats(formats)
  26. title = json.loads(js_to_json(self._search_regex(
  27. r'var mediaTitles\s*=\s*(.*?);\n', webpage, 'title')))[0]
  28. return {
  29. 'id': video_id,
  30. 'title': title,
  31. 'formats': formats,
  32. 'description': self._og_search_description(webpage),
  33. 'thumbnail': self._og_search_thumbnail(webpage),
  34. }