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.

56 lines
2.2 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. from .ard import ARDMediathekIE
  4. from ..utils import (
  5. ExtractorError,
  6. get_element_by_attribute,
  7. )
  8. class SRMediathekIE(ARDMediathekIE):
  9. IE_DESC = 'Saarländischer Rundfunk'
  10. _VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
  11. _TESTS = [{
  12. 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
  13. 'info_dict': {
  14. 'id': '28455',
  15. 'ext': 'mp4',
  16. 'title': 'sportarena (26.10.2014)',
  17. '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 ',
  18. 'thumbnail': 're:^https?://.*\.jpg$',
  19. },
  20. 'skip': 'no longer available',
  21. }, {
  22. 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=37682',
  23. 'info_dict': {
  24. 'id': '37682',
  25. 'ext': 'mp4',
  26. 'title': 'Love, Cakes and Rock\'n\'Roll',
  27. 'description': 'md5:18bf9763631c7d326c22603681e1123d',
  28. },
  29. 'params': {
  30. # m3u8 download
  31. 'skip_download': True,
  32. },
  33. 'expected_warnings': ['Unable to download f4m manifest']
  34. }]
  35. def _real_extract(self, url):
  36. video_id = self._match_id(url)
  37. webpage = self._download_webpage(url, video_id)
  38. if '>Der gew&uuml;nschte Beitrag ist leider nicht mehr verf&uuml;gbar.<' in webpage:
  39. raise ExtractorError('Video %s is no longer available' % video_id, expected=True)
  40. media_collection_url = self._search_regex(
  41. r'data-mediacollection-ardplayer="([^"]+)"', webpage, 'media collection url')
  42. info = self._extract_media_info(media_collection_url, webpage, video_id)
  43. info.update({
  44. 'id': video_id,
  45. 'title': get_element_by_attribute('class', 'ardplayer-title', webpage),
  46. 'description': self._og_search_description(webpage),
  47. 'thumbnail': self._og_search_thumbnail(webpage),
  48. })
  49. return info