2015-11-08 05:56:20 -05:00
|
|
|
|
# coding: utf-8
|
2014-08-23 06:44:56 -04:00
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2016-04-01 11:22:06 -04:00
|
|
|
|
from ..utils import (
|
|
|
|
|
smuggle_url,
|
|
|
|
|
float_or_none,
|
|
|
|
|
parse_iso8601,
|
|
|
|
|
update_url_query,
|
|
|
|
|
)
|
2014-08-23 06:44:56 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MovieClipsIE(InfoExtractor):
|
2016-10-24 12:54:03 -04:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?movieclips\.com/videos/.+-(?P<id>\d+)(?:\?|$)'
|
2014-08-23 06:44:56 -04:00
|
|
|
|
_TEST = {
|
2016-04-01 11:22:06 -04:00
|
|
|
|
'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597',
|
|
|
|
|
'md5': '42b5a0352d4933a7bd54f2104f481244',
|
2014-08-23 06:44:56 -04:00
|
|
|
|
'info_dict': {
|
2015-11-08 05:49:51 -05:00
|
|
|
|
'id': 'pKIGmG83AqD9',
|
2014-08-23 06:44:56 -04:00
|
|
|
|
'ext': 'mp4',
|
2015-11-08 05:49:51 -05:00
|
|
|
|
'title': 'Warcraft Trailer 1',
|
|
|
|
|
'description': 'Watch Trailer 1 from Warcraft (2016). Legendary’s WARCRAFT is a 3D epic adventure of world-colliding conflict based.',
|
2014-08-23 06:44:56 -04:00
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg$',
|
2016-04-01 11:22:06 -04:00
|
|
|
|
'timestamp': 1446843055,
|
|
|
|
|
'upload_date': '20151106',
|
|
|
|
|
'uploader': 'Movieclips',
|
2014-08-23 06:44:56 -04:00
|
|
|
|
},
|
2015-11-08 05:49:51 -05:00
|
|
|
|
'add_ie': ['ThePlatform'],
|
2014-08-23 06:44:56 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-04-01 11:22:06 -04:00
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
video = next(v for v in self._parse_json(self._search_regex(
|
|
|
|
|
r'var\s+__REACT_ENGINE__\s*=\s*({.+});',
|
|
|
|
|
webpage, 'react engine'), video_id)['playlist']['videos'] if v['id'] == video_id)
|
2014-08-23 06:44:56 -04:00
|
|
|
|
|
|
|
|
|
return {
|
2015-11-08 05:49:51 -05:00
|
|
|
|
'_type': 'url_transparent',
|
2016-04-01 11:22:06 -04:00
|
|
|
|
'ie_key': 'ThePlatform',
|
|
|
|
|
'url': smuggle_url(update_url_query(
|
|
|
|
|
video['contentUrl'], {'mbr': 'true'}), {'force_smil_url': True}),
|
|
|
|
|
'title': self._og_search_title(webpage),
|
|
|
|
|
'description': self._html_search_meta('description', webpage),
|
|
|
|
|
'duration': float_or_none(video.get('duration')),
|
|
|
|
|
'timestamp': parse_iso8601(video.get('dateCreated')),
|
|
|
|
|
'thumbnail': video.get('defaultImage'),
|
|
|
|
|
'uploader': video.get('provider'),
|
2014-08-23 06:44:56 -04:00
|
|
|
|
}
|