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