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.

40 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .dplay import DPlayIE
  5. class DiscoveryNetworksDeIE(DPlayIE):
  6. _VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show)/(?P<programme>[^/]+)/video/(?P<alternate_id>[^/]+)'
  7. _TESTS = [{
  8. 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
  9. 'info_dict': {
  10. 'id': '78867',
  11. 'ext': 'mp4',
  12. 'title': 'Die Welt da draußen',
  13. 'description': 'md5:61033c12b73286e409d99a41742ef608',
  14. 'timestamp': 1554069600,
  15. 'upload_date': '20190331',
  16. },
  17. 'params': {
  18. 'format': 'bestvideo',
  19. 'skip_download': True,
  20. },
  21. }, {
  22. 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
  23. 'only_matching': True,
  24. }, {
  25. 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
  26. 'only_matching': True,
  27. }]
  28. def _real_extract(self, url):
  29. domain, programme, alternate_id = re.match(self._VALID_URL, url).groups()
  30. country = 'GB' if domain == 'dplay.co.uk' else 'DE'
  31. realm = 'questuk' if country == 'GB' else domain.replace('.', '')
  32. return self._get_disco_api_info(
  33. url, '%s/%s' % (programme, alternate_id),
  34. 'sonic-eu1-prod.disco-api.com', realm, country)