]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dctp.py
New upstream version 2016.12.01
[youtubedl] / youtube_dl / extractor / dctp.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import unified_strdate
6
7
8 class DctpTvIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?dctp\.tv/(#/)?filme/(?P<id>.+?)/$'
10 _TEST = {
11 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
12 'md5': '174dd4a8a6225cf5655952f969cfbe24',
13 'info_dict': {
14 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
15 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
16 'ext': 'mp4',
17 'title': 'Videoinstallation für eine Kaufhausfassade',
18 'description': 'Kurzfilm',
19 'upload_date': '20110407',
20 'thumbnail': 're:^https?://.*\.jpg$',
21 },
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27
28 object_id = self._html_search_meta('DC.identifier', webpage)
29
30 servers_json = self._download_json(
31 'http://www.dctp.tv/elastic_streaming_client/get_streaming_server/',
32 video_id, note='Downloading server list')
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)
45
46 return {
47 'id': object_id,
48 'title': title,
49 'formats': formats,
50 'display_id': video_id,
51 'description': description,
52 'upload_date': upload_date,
53 'thumbnail': thumbnail,
54 }