logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

tele5.py (3333B)


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