srmediathek.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. from .ard import ARDMediathekBaseIE
  2. from ..utils import (
  3. ExtractorError,
  4. get_element_by_attribute,
  5. )
  6. class SRMediathekIE(ARDMediathekBaseIE):
  7. _WORKING = False
  8. IE_NAME = 'sr:mediathek'
  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': r'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. }, {
  34. 'url': 'http://sr-mediathek.de/index.php?seite=7&id=7480',
  35. 'only_matching': True,
  36. }]
  37. def _real_extract(self, url):
  38. video_id = self._match_id(url)
  39. webpage = self._download_webpage(url, video_id)
  40. if '>Der gew&uuml;nschte Beitrag ist leider nicht mehr verf&uuml;gbar.<' in webpage:
  41. raise ExtractorError(f'Video {video_id} is no longer available', expected=True)
  42. media_collection_url = self._search_regex(
  43. r'data-mediacollection-ardplayer="([^"]+)"', webpage, 'media collection url')
  44. info = self._extract_media_info(media_collection_url, webpage, video_id)
  45. info.update({
  46. 'id': video_id,
  47. 'title': get_element_by_attribute('class', 'ardplayer-title', webpage),
  48. 'description': self._og_search_description(webpage),
  49. 'thumbnail': self._og_search_thumbnail(webpage),
  50. })
  51. return info