]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/netzkino.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
15 class NetzkinoIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?netzkino\.de/\#!/(?P<category>[^/]+)/(?P<id>[^/]+)'
19 'url': 'http://www.netzkino.de/#!/scifikino/rakete-zum-mond',
20 'md5': '92a3f8b76f8d7220acce5377ea5d4873',
22 'id': 'rakete-zum-mond',
24 'title': 'Rakete zum Mond (Endstation Mond, Destination Moon)',
25 'comments': 'mincount:3',
26 'description': 'md5:1eddeacc7e62d5a25a2d1a7290c64a28',
27 'upload_date': '20120813',
28 'thumbnail': 're:https?://.*\.jpg$',
29 'timestamp': 1344858571,
34 def _real_extract(self
, url
):
35 mobj
= re
.match(self
._VALID
_URL
, url
)
36 category_id
= mobj
.group('category')
37 video_id
= mobj
.group('id')
39 api_url
= 'http://api.netzkino.de.simplecache.net/capi-2.0a/categories/%s.json?d=www' % category_id
40 api_info
= self
._download
_json
(api_url
, video_id
)
42 p
for p
in api_info
['posts'] if p
['slug'] == video_id
)
43 custom_fields
= info
['custom_fields']
45 production_js
= self
._download
_webpage
(
46 'http://www.netzkino.de/beta/dist/production.min.js', video_id
,
47 note
='Downloading player code')
48 avo_js
= self
._search
_regex
(
49 r
'window\.avoCore\s*=.*?urlTemplate:\s*(\{.*?"\})',
50 production_js
, 'URL templates')
51 templates
= self
._parse
_json
(
52 avo_js
, video_id
, transform_source
=js_to_json
)
55 'hds': '.mp4/manifest.f4m',
56 'hls': '.mp4/master.m3u8',
59 film_fn
= custom_fields
['Streaming'][0]
63 'url': tpl
.replace('{}', film_fn
) + suffix
[key
],
64 } for key
, tpl
in templates
.items()]
65 self
._sort
_formats
(formats
)
68 'timestamp': parse_iso8601(c
.get('date'), delimiter
=' '),
72 'parent': 'root' if c
.get('parent', 0) == 0 else c
['parent'],
73 } for c
in info
.get('comments', [])]
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 'playlist_title': api_info
.get('title'),
85 'playlist_id': category_id
,