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.

57 lines
2.0 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .nexx import NexxIE
  5. from ..compat import compat_urlparse
  6. class Tele5IE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)'
  8. _TESTS = [{
  9. 'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
  10. 'info_dict': {
  11. 'id': '1549416',
  12. 'ext': 'mp4',
  13. 'upload_date': '20180814',
  14. 'timestamp': 1534290623,
  15. 'title': 'Pandorum',
  16. },
  17. 'params': {
  18. 'skip_download': True,
  19. },
  20. }, {
  21. 'url': 'https://www.tele5.de/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
  22. 'only_matching': True,
  23. }, {
  24. 'url': 'https://www.tele5.de/video-clip/?ve_id=1609440',
  25. 'only_matching': True,
  26. }, {
  27. 'url': 'https://www.tele5.de/filme/schlefaz-dragon-crusaders/',
  28. 'only_matching': True,
  29. }, {
  30. 'url': 'https://www.tele5.de/filme/making-of/avengers-endgame/',
  31. 'only_matching': True,
  32. }, {
  33. 'url': 'https://www.tele5.de/star-trek/raumschiff-voyager/ganze-folge/das-vinculum/',
  34. 'only_matching': True,
  35. }, {
  36. 'url': 'https://www.tele5.de/anders-ist-sevda/',
  37. 'only_matching': True,
  38. }]
  39. def _real_extract(self, url):
  40. qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
  41. video_id = (qs.get('vid') or qs.get('ve_id') or [None])[0]
  42. if not video_id:
  43. display_id = self._match_id(url)
  44. webpage = self._download_webpage(url, display_id)
  45. video_id = self._html_search_regex(
  46. (r'id\s*=\s*["\']video-player["\'][^>]+data-id\s*=\s*["\'](\d+)',
  47. r'\s+id\s*=\s*["\']player_(\d{6,})',
  48. r'\bdata-id\s*=\s*["\'](\d{6,})'), webpage, 'video id')
  49. return self.url_result(
  50. 'https://api.nexx.cloud/v3/759/videos/byid/%s' % video_id,
  51. ie=NexxIE.ie_key(), video_id=video_id)