]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/moviezine.py
[LnkIE] Add extractor (#2408)
[yt-dlp.git] / yt_dlp / extractor / moviezine.py
CommitLineData
dcdb292f 1# coding: utf-8
3f53a75f 2from __future__ import unicode_literals
3
3f53a75f 4
5from .common import InfoExtractor
6
7
8class MoviezineIE(InfoExtractor):
92519402 9 _VALID_URL = r'https?://(?:www\.)?moviezine\.se/video/(?P<id>[^?#]+)'
3f53a75f 10
11 _TEST = {
12 'url': 'http://www.moviezine.se/video/205866',
13 'info_dict': {
14 'id': '205866',
15 'ext': 'mp4',
16 'title': 'Oculus - Trailer 1',
17 'description': 'md5:40cc6790fc81d931850ca9249b40e8a4',
ec85ded8 18 'thumbnail': r're:http://.*\.jpg',
3f53a75f 19 },
20 }
21
22 def _real_extract(self, url):
5ad28e7f 23 mobj = self._match_valid_url(url)
3f53a75f 24 video_id = mobj.group('id')
25
26 webpage = self._download_webpage(url, video_id)
27 jsplayer = self._download_webpage('http://www.moviezine.se/api/player.js?video=%s' % video_id, video_id, 'Downloading js api player')
28
5f6a1245 29 formats = [{
3f53a75f 30 'format_id': 'sd',
31 'url': self._html_search_regex(r'file: "(.+?)",', jsplayer, 'file'),
32 'quality': 0,
33 'ext': 'mp4',
34 }]
35
36 self._sort_formats(formats)
37
38 return {
39 'id': video_id,
40 'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'),
41 'thumbnail': self._search_regex(r'image: "(.+?)",', jsplayer, 'image'),
42 'formats': formats,
43 'description': self._og_search_description(webpage),
44 }