tele5.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. from .dplay import DPlayIE
  2. from ..compat import compat_urlparse
  3. from ..utils import (
  4. ExtractorError,
  5. extract_attributes,
  6. )
  7. class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
  8. _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)'
  9. _GEO_COUNTRIES = ['DE']
  10. _TESTS = [{
  11. 'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
  12. 'info_dict': {
  13. 'id': '1549416',
  14. 'ext': 'mp4',
  15. 'upload_date': '20180814',
  16. 'timestamp': 1534290623,
  17. 'title': 'Pandorum',
  18. },
  19. 'params': {
  20. 'skip_download': True,
  21. },
  22. 'skip': 'No longer available: "404 Seite nicht gefunden"',
  23. }, {
  24. # jwplatform, nexx unavailable
  25. 'url': 'https://www.tele5.de/filme/ghoul-das-geheimnis-des-friedhofmonsters/',
  26. 'info_dict': {
  27. 'id': 'WJuiOlUp',
  28. 'ext': 'mp4',
  29. 'upload_date': '20200603',
  30. 'timestamp': 1591214400,
  31. 'title': 'Ghoul - Das Geheimnis des Friedhofmonsters',
  32. 'description': 'md5:42002af1d887ff3d5b2b3ca1f8137d97',
  33. },
  34. 'params': {
  35. 'skip_download': True,
  36. },
  37. 'skip': 'No longer available, redirects to Filme page',
  38. }, {
  39. 'url': 'https://tele5.de/mediathek/angel-of-mine/',
  40. 'info_dict': {
  41. 'id': '1252360',
  42. 'ext': 'mp4',
  43. 'upload_date': '20220109',
  44. 'timestamp': 1641762000,
  45. 'title': 'Angel of Mine',
  46. 'description': 'md5:a72546a175e1286eb3251843a52d1ad7',
  47. },
  48. 'params': {
  49. 'format': 'bestvideo',
  50. },
  51. }, {
  52. 'url': 'https://www.tele5.de/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
  53. 'only_matching': True,
  54. }, {
  55. 'url': 'https://www.tele5.de/video-clip/?ve_id=1609440',
  56. 'only_matching': True,
  57. }, {
  58. 'url': 'https://www.tele5.de/filme/schlefaz-dragon-crusaders/',
  59. 'only_matching': True,
  60. }, {
  61. 'url': 'https://www.tele5.de/filme/making-of/avengers-endgame/',
  62. 'only_matching': True,
  63. }, {
  64. 'url': 'https://www.tele5.de/star-trek/raumschiff-voyager/ganze-folge/das-vinculum/',
  65. 'only_matching': True,
  66. }, {
  67. 'url': 'https://www.tele5.de/anders-ist-sevda/',
  68. 'only_matching': True,
  69. }]
  70. def _real_extract(self, url):
  71. video_id = self._match_id(url)
  72. webpage = self._download_webpage(url, video_id)
  73. player_element = self._search_regex(r'(<hyoga-player\b[^>]+?>)', webpage, 'video player')
  74. player_info = extract_attributes(player_element)
  75. asset_id, country, realm = (player_info[x] for x in ('assetid', 'locale', 'realm', ))
  76. endpoint = compat_urlparse.urlparse(player_info['endpoint']).hostname
  77. source_type = player_info.get('sourcetype')
  78. if source_type:
  79. endpoint = '%s-%s' % (source_type, endpoint)
  80. try:
  81. return self._get_disco_api_info(url, asset_id, endpoint, realm, country)
  82. except ExtractorError as e:
  83. if getattr(e, 'message', '') == 'Missing deviceId in context':
  84. self.report_drm(video_id)
  85. raise