]>
Commit | Line | Data |
---|---|---|
1 | from .common import InfoExtractor | |
2 | from ..utils import ( | |
3 | clean_html, | |
4 | int_or_none, | |
5 | js_to_json, | |
6 | parse_iso8601, | |
7 | ) | |
8 | ||
9 | ||
10 | class NetzkinoIE(InfoExtractor): | |
11 | _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id>[^/]+)' | |
12 | ||
13 | _TESTS = [{ | |
14 | 'url': 'https://www.netzkino.de/#!/scifikino/rakete-zum-mond', | |
15 | 'md5': '92a3f8b76f8d7220acce5377ea5d4873', | |
16 | 'info_dict': { | |
17 | 'id': 'rakete-zum-mond', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Rakete zum Mond \u2013 Jules Verne', | |
20 | 'description': 'md5:f0a8024479618ddbfa450ff48ffa6c60', | |
21 | 'upload_date': '20120813', | |
22 | 'thumbnail': r're:https?://.*\.jpg$', | |
23 | 'timestamp': 1344858571, | |
24 | 'age_limit': 12, | |
25 | }, | |
26 | 'params': { | |
27 | 'skip_download': 'Download only works from Germany', | |
28 | } | |
29 | }, { | |
30 | 'url': 'https://www.netzkino.de/#!/filme/dr-jekyll-mrs-hyde-2', | |
31 | 'md5': 'c7728b2dadd04ff6727814847a51ef03', | |
32 | 'info_dict': { | |
33 | 'id': 'dr-jekyll-mrs-hyde-2', | |
34 | 'ext': 'mp4', | |
35 | 'title': 'Dr. Jekyll & Mrs. Hyde 2', | |
36 | 'description': 'md5:c2e9626ebd02de0a794b95407045d186', | |
37 | 'upload_date': '20190130', | |
38 | 'thumbnail': r're:https?://.*\.jpg$', | |
39 | 'timestamp': 1548849437, | |
40 | 'age_limit': 18, | |
41 | }, | |
42 | 'params': { | |
43 | 'skip_download': 'Download only works from Germany', | |
44 | } | |
45 | }] | |
46 | ||
47 | def _real_extract(self, url): | |
48 | mobj = self._match_valid_url(url) | |
49 | video_id = mobj.group('id') | |
50 | ||
51 | api_url = 'https://api.netzkino.de.simplecache.net/capi-2.0a/movies/%s.json?d=www' % video_id | |
52 | info = self._download_json(api_url, video_id) | |
53 | custom_fields = info['custom_fields'] | |
54 | ||
55 | production_js = self._download_webpage( | |
56 | 'http://www.netzkino.de/beta/dist/production.min.js', video_id, | |
57 | note='Downloading player code') | |
58 | avo_js = self._search_regex( | |
59 | r'var urlTemplate=(\{.*?"\})', | |
60 | production_js, 'URL templates') | |
61 | templates = self._parse_json( | |
62 | avo_js, video_id, transform_source=js_to_json) | |
63 | ||
64 | suffix = { | |
65 | 'hds': '.mp4/manifest.f4m', | |
66 | 'hls': '.mp4/master.m3u8', | |
67 | 'pmd': '.mp4', | |
68 | } | |
69 | film_fn = custom_fields['Streaming'][0] | |
70 | formats = [{ | |
71 | 'format_id': key, | |
72 | 'ext': 'mp4', | |
73 | 'url': tpl.replace('{}', film_fn) + suffix[key], | |
74 | } for key, tpl in templates.items()] | |
75 | ||
76 | return { | |
77 | 'id': video_id, | |
78 | 'formats': formats, | |
79 | 'title': info['title'], | |
80 | 'age_limit': int_or_none(custom_fields.get('FSK')[0]), | |
81 | 'timestamp': parse_iso8601(info.get('date'), delimiter=' '), | |
82 | 'description': clean_html(info.get('content')), | |
83 | 'thumbnail': info.get('thumbnail'), | |
84 | } |