]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/dctp.py
Fix "invalid escape sequences" error on Python 3.6
[yt-dlp.git] / youtube_dl / extractor / dctp.py
CommitLineData
e295618f 1# coding: utf-8
0865f397
PH
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
e295618f 5from ..utils import unified_strdate
0865f397 6
48a1e514 7
0865f397 8class DctpTvIE(InfoExtractor):
92519402 9 _VALID_URL = r'https?://(?:www\.)?dctp\.tv/(#/)?filme/(?P<id>.+?)/$'
48a1e514
PH
10 _TEST = {
11 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
e295618f 12 'md5': '174dd4a8a6225cf5655952f969cfbe24',
48a1e514 13 'info_dict': {
e295618f 14 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
75a4fc5b 15 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
e295618f
YCH
16 'ext': 'mp4',
17 'title': 'Videoinstallation für eine Kaufhausfassade',
18 'description': 'Kurzfilm',
19 'upload_date': '20110407',
ec85ded8 20 'thumbnail': r're:^https?://.*\.jpg$',
c56d7d89 21 },
83fddfd4 22 }
0865f397
PH
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
e295618f
YCH
26 webpage = self._download_webpage(url, video_id)
27
28 object_id = self._html_search_meta('DC.identifier', webpage)
0865f397 29
6ebb0dca 30 servers_json = self._download_json(
e295618f 31 'http://www.dctp.tv/elastic_streaming_client/get_streaming_server/',
6ebb0dca 32 video_id, note='Downloading server list')
e295618f
YCH
33 server = servers_json[0]['server']
34 m3u8_path = self._search_regex(
35 r'\'([^\'"]+/playlist\.m3u8)"', webpage, 'm3u8 path')
36 formats = self._extract_m3u8_formats(
37 'http://%s%s' % (server, m3u8_path), video_id, ext='mp4',
38 entry_protocol='m3u8_native')
39
40 title = self._og_search_title(webpage)
41 description = self._html_search_meta('DC.description', webpage)
42 upload_date = unified_strdate(
43 self._html_search_meta('DC.date.created', webpage))
44 thumbnail = self._og_search_thumbnail(webpage)
0865f397
PH
45
46 return {
87673cd4 47 'id': object_id,
0865f397 48 'title': title,
e295618f
YCH
49 'formats': formats,
50 'display_id': video_id,
51 'description': description,
52 'upload_date': upload_date,
53 'thumbnail': thumbnail,
0865f397 54 }