mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[movieclips] Fix extraction (fixes #7404)
They use theplatform now. Changed the test, because the old one seems to be georestricted.
This commit is contained in:
parent
e8ce2375e0
commit
d5c181a14e
1 changed files with 19 additions and 58 deletions
|
@ -1,80 +1,41 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_str,
|
compat_urllib_request,
|
||||||
)
|
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
clean_html,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MovieClipsIE(InfoExtractor):
|
class MovieClipsIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://movieclips\.com/(?P<id>[\da-zA-Z]+)(?:-(?P<display_id>[\da-z-]+))?'
|
_VALID_URL = r'https?://(?:www.)?movieclips\.com/videos/(?P<id>[^/?#]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://movieclips.com/Wy7ZU-my-week-with-marilyn-movie-do-you-love-me/',
|
'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597?autoPlay=true&playlistId=5',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'Wy7ZU',
|
'id': 'pKIGmG83AqD9',
|
||||||
'display_id': 'my-week-with-marilyn-movie-do-you-love-me',
|
'display_id': 'warcraft-trailer-1-561180739597',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'My Week with Marilyn - Do You Love Me?',
|
'title': 'Warcraft Trailer 1',
|
||||||
'description': 'md5:e86795bd332fe3cff461e7c8dc542acb',
|
'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$',
|
||||||
},
|
},
|
||||||
'params': {
|
'add_ie': ['ThePlatform'],
|
||||||
# rtmp download
|
|
||||||
'skip_download': True,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
display_id = self._match_id(url)
|
||||||
video_id = mobj.group('id')
|
|
||||||
display_id = mobj.group('display_id')
|
|
||||||
show_id = display_id or video_id
|
|
||||||
|
|
||||||
config = self._download_xml(
|
req = compat_urllib_request.Request(url)
|
||||||
'http://config.movieclips.com/player/config/%s' % video_id,
|
# it doesn't work if it thinks the browser it's too old
|
||||||
show_id, 'Downloading player config')
|
req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/43.0 (Chrome)')
|
||||||
|
webpage = self._download_webpage(req, display_id)
|
||||||
if config.find('./country-region').text == 'false':
|
theplatform_link = self._html_search_regex(r'src="(http://player.theplatform.com/p/.*?)"', webpage, 'theplatform link')
|
||||||
raise ExtractorError(
|
title = self._html_search_regex(r'<title[^>]*>([^>]+)-\s*\d+\s*|\s*Movieclips.com</title>', webpage, 'title')
|
||||||
'%s said: %s' % (self.IE_NAME, config.find('./region_alert').text), expected=True)
|
description = self._html_search_meta('description', webpage)
|
||||||
|
|
||||||
properties = config.find('./video/properties')
|
|
||||||
smil_file = properties.attrib['smil_file']
|
|
||||||
|
|
||||||
smil = self._download_xml(smil_file, show_id, 'Downloading SMIL')
|
|
||||||
base_url = smil.find('./head/meta').attrib['base']
|
|
||||||
|
|
||||||
formats = []
|
|
||||||
for video in smil.findall('./body/switch/video'):
|
|
||||||
vbr = int(video.attrib['system-bitrate']) / 1000
|
|
||||||
src = video.attrib['src']
|
|
||||||
formats.append({
|
|
||||||
'url': base_url,
|
|
||||||
'play_path': src,
|
|
||||||
'ext': src.split(':')[0],
|
|
||||||
'vbr': vbr,
|
|
||||||
'format_id': '%dk' % vbr,
|
|
||||||
})
|
|
||||||
|
|
||||||
self._sort_formats(formats)
|
|
||||||
|
|
||||||
title = '%s - %s' % (properties.attrib['clip_movie_title'], properties.attrib['clip_title'])
|
|
||||||
description = clean_html(compat_str(properties.attrib['clip_description']))
|
|
||||||
thumbnail = properties.attrib['image']
|
|
||||||
categories = properties.attrib['clip_categories'].split(',')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'_type': 'url_transparent',
|
||||||
'display_id': display_id,
|
'url': theplatform_link,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
'display_id': display_id,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
|
||||||
'categories': categories,
|
|
||||||
'formats': formats,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue