Initial clone based on d65d89183f645a0e95910c3861491a75c26000eb upstream which is...
[youtube-dl.git] / youtube_dl / extractor / moviezine.py
blob85cc6e22f59cd5af0e194dee675beb3bc69a9369
1 # coding: utf-8
2 from __future__ import unicode_literals
4 import re
6 from .common import InfoExtractor
9 class MoviezineIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?moviezine\.se/video/(?P<id>[^?#]+)'
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',
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
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')
30 formats = [{
31 'format_id': 'sd',
32 'url': self._html_search_regex(r'file: "(.+?)",', jsplayer, 'file'),
33 'quality': 0,
34 'ext': 'mp4',
37 self._sort_formats(formats)
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),