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