]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/discoverynetworks.py
Update upstream source from tag 'upstream/2020.03.24'
[youtubedl] / youtube_dl / extractor / discoverynetworks.py
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)/(?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
34 def _real_extract(self, url):
35 domain, programme, alternate_id = re.match(self._VALID_URL, url).groups()
36 country = 'GB' if domain == 'dplay.co.uk' else 'DE'
37 realm = 'questuk' if country == 'GB' else domain.replace('.', '')
38 return self._get_disco_api_info(
39 url, '%s/%s' % (programme, alternate_id),
40 'sonic-eu1-prod.disco-api.com', realm, country)