]>
Commit | Line | Data |
---|---|---|
fda2717e | 1 | # coding: utf-8 |
bc0bb6fd S |
2 | from __future__ import unicode_literals |
3 | ||
bc0bb6fd | 4 | from .common import InfoExtractor |
3f64379e | 5 | from ..utils import ( |
6 | smuggle_url, | |
7 | float_or_none, | |
8 | parse_iso8601, | |
9 | update_url_query, | |
10 | ) | |
bc0bb6fd S |
11 | |
12 | ||
13 | class MovieClipsIE(InfoExtractor): | |
d7d4481c | 14 | _VALID_URL = r'https?://(?:www\.)?movieclips\.com/videos/.+-(?P<id>\d+)(?:\?|$)' |
bc0bb6fd | 15 | _TEST = { |
3f64379e | 16 | 'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597', |
17 | 'md5': '42b5a0352d4933a7bd54f2104f481244', | |
bc0bb6fd | 18 | 'info_dict': { |
d5c181a1 | 19 | 'id': 'pKIGmG83AqD9', |
bc0bb6fd | 20 | 'ext': 'mp4', |
d5c181a1 JMF |
21 | 'title': 'Warcraft Trailer 1', |
22 | 'description': 'Watch Trailer 1 from Warcraft (2016). Legendary’s WARCRAFT is a 3D epic adventure of world-colliding conflict based.', | |
ec85ded8 | 23 | 'thumbnail': r're:^https?://.*\.jpg$', |
3f64379e | 24 | 'timestamp': 1446843055, |
25 | 'upload_date': '20151106', | |
26 | 'uploader': 'Movieclips', | |
bc0bb6fd | 27 | }, |
d5c181a1 | 28 | 'add_ie': ['ThePlatform'], |
bc0bb6fd S |
29 | } |
30 | ||
31 | def _real_extract(self, url): | |
3f64379e | 32 | video_id = self._match_id(url) |
33 | webpage = self._download_webpage(url, video_id) | |
34 | video = next(v for v in self._parse_json(self._search_regex( | |
35 | r'var\s+__REACT_ENGINE__\s*=\s*({.+});', | |
36 | webpage, 'react engine'), video_id)['playlist']['videos'] if v['id'] == video_id) | |
bc0bb6fd S |
37 | |
38 | return { | |
d5c181a1 | 39 | '_type': 'url_transparent', |
3f64379e | 40 | 'ie_key': 'ThePlatform', |
41 | 'url': smuggle_url(update_url_query( | |
42 | video['contentUrl'], {'mbr': 'true'}), {'force_smil_url': True}), | |
43 | 'title': self._og_search_title(webpage), | |
44 | 'description': self._html_search_meta('description', webpage), | |
45 | 'duration': float_or_none(video.get('duration')), | |
46 | 'timestamp': parse_iso8601(video.get('dateCreated')), | |
47 | 'thumbnail': video.get('defaultImage'), | |
48 | 'uploader': video.get('provider'), | |
bc0bb6fd | 49 | } |