mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[movieclips] fix extraction
This commit is contained in:
parent
3e0c3d14d9
commit
3f64379eda
1 changed files with 26 additions and 17 deletions
|
@ -2,39 +2,48 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import sanitized_Request
|
from ..utils import (
|
||||||
|
smuggle_url,
|
||||||
|
float_or_none,
|
||||||
|
parse_iso8601,
|
||||||
|
update_url_query,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MovieClipsIE(InfoExtractor):
|
class MovieClipsIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www.)?movieclips\.com/videos/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://(?:www.)?movieclips\.com/videos/.+-(?P<id>\d+)(?:\?|$)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597?autoPlay=true&playlistId=5',
|
'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597',
|
||||||
|
'md5': '42b5a0352d4933a7bd54f2104f481244',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'pKIGmG83AqD9',
|
'id': 'pKIGmG83AqD9',
|
||||||
'display_id': 'warcraft-trailer-1-561180739597',
|
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Warcraft Trailer 1',
|
'title': 'Warcraft Trailer 1',
|
||||||
'description': 'Watch Trailer 1 from Warcraft (2016). Legendary’s WARCRAFT is a 3D epic adventure of world-colliding conflict based.',
|
'description': 'Watch Trailer 1 from Warcraft (2016). Legendary’s WARCRAFT is a 3D epic adventure of world-colliding conflict based.',
|
||||||
'thumbnail': 're:^https?://.*\.jpg$',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'timestamp': 1446843055,
|
||||||
|
'upload_date': '20151106',
|
||||||
|
'uploader': 'Movieclips',
|
||||||
},
|
},
|
||||||
'add_ie': ['ThePlatform'],
|
'add_ie': ['ThePlatform'],
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
req = sanitized_Request(url)
|
video = next(v for v in self._parse_json(self._search_regex(
|
||||||
# it doesn't work if it thinks the browser it's too old
|
r'var\s+__REACT_ENGINE__\s*=\s*({.+});',
|
||||||
req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/43.0 (Chrome)')
|
webpage, 'react engine'), video_id)['playlist']['videos'] if v['id'] == video_id)
|
||||||
webpage = self._download_webpage(req, display_id)
|
|
||||||
theplatform_link = self._html_search_regex(r'src="(http://player.theplatform.com/p/.*?)"', webpage, 'theplatform link')
|
|
||||||
title = self._html_search_regex(r'<title[^>]*>([^>]+)-\s*\d+\s*|\s*Movieclips.com</title>', webpage, 'title')
|
|
||||||
description = self._html_search_meta('description', webpage)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'url': theplatform_link,
|
'ie_key': 'ThePlatform',
|
||||||
'title': title,
|
'url': smuggle_url(update_url_query(
|
||||||
'display_id': display_id,
|
video['contentUrl'], {'mbr': 'true'}), {'force_smil_url': True}),
|
||||||
'description': description,
|
'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'),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue