youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

discoverynetworks.py (1642B)


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