2016-10-02 04:39:18 -07:00
|
|
|
# coding: utf-8
|
2014-04-26 09:55:29 -07:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
class MoviezineIE(InfoExtractor):
|
2016-09-08 04:29:05 -07:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?moviezine\.se/video/(?P<id>[^?#]+)'
|
2014-04-26 09:55:29 -07:00
|
|
|
|
|
|
|
_TEST = {
|
|
|
|
'url': 'http://www.moviezine.se/video/205866',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '205866',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Oculus - Trailer 1',
|
|
|
|
'description': 'md5:40cc6790fc81d931850ca9249b40e8a4',
|
2017-01-02 04:08:07 -08:00
|
|
|
'thumbnail': r're:http://.*\.jpg',
|
2014-04-26 09:55:29 -07:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
video_id = mobj.group('id')
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
jsplayer = self._download_webpage('http://www.moviezine.se/api/player.js?video=%s' % video_id, video_id, 'Downloading js api player')
|
|
|
|
|
2014-11-23 11:41:03 -08:00
|
|
|
formats = [{
|
2014-04-26 09:55:29 -07:00
|
|
|
'format_id': 'sd',
|
|
|
|
'url': self._html_search_regex(r'file: "(.+?)",', jsplayer, 'file'),
|
|
|
|
'quality': 0,
|
|
|
|
'ext': 'mp4',
|
|
|
|
}]
|
|
|
|
|
|
|
|
self._sort_formats(formats)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'),
|
|
|
|
'thumbnail': self._search_regex(r'image: "(.+?)",', jsplayer, 'image'),
|
|
|
|
'formats': formats,
|
|
|
|
'description': self._og_search_description(webpage),
|
|
|
|
}
|