]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/moviezine.py
debian/control: Set 'Rules-Requires-Root: no'.
[youtubedl] / youtube_dl / extractor / moviezine.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class MoviezineIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?moviezine\.se/video/(?P<id>[^?#]+)'
11
12 _TEST = {
13 'url': 'http://www.moviezine.se/video/205866',
14 'info_dict': {
15 'id': '205866',
16 'ext': 'mp4',
17 'title': 'Oculus - Trailer 1',
18 'description': 'md5:40cc6790fc81d931850ca9249b40e8a4',
19 'thumbnail': r're:http://.*\.jpg',
20 },
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
26
27 webpage = self._download_webpage(url, video_id)
28 jsplayer = self._download_webpage('http://www.moviezine.se/api/player.js?video=%s' % video_id, video_id, 'Downloading js api player')
29
30 formats = [{
31 'format_id': 'sd',
32 'url': self._html_search_regex(r'file: "(.+?)",', jsplayer, 'file'),
33 'quality': 0,
34 'ext': 'mp4',
35 }]
36
37 self._sort_formats(formats)
38
39 return {
40 'id': video_id,
41 'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'),
42 'thumbnail': self._search_regex(r'image: "(.+?)",', jsplayer, 'image'),
43 'formats': formats,
44 'description': self._og_search_description(webpage),
45 }