]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/movieclips.py
Merge pull request #8061 from dstftw/introduce-chapter-and-series-fields
[yt-dlp.git] / youtube_dl / extractor / movieclips.py
CommitLineData
fda2717e 1# coding: utf-8
bc0bb6fd
S
2from __future__ import unicode_literals
3
bc0bb6fd 4from .common import InfoExtractor
5c2266df 5from ..utils import sanitized_Request
bc0bb6fd
S
6
7
8class MovieClipsIE(InfoExtractor):
d5c181a1 9 _VALID_URL = r'https?://(?:www.)?movieclips\.com/videos/(?P<id>[^/?#]+)'
bc0bb6fd 10 _TEST = {
d5c181a1 11 'url': 'http://www.movieclips.com/videos/warcraft-trailer-1-561180739597?autoPlay=true&playlistId=5',
bc0bb6fd 12 'info_dict': {
d5c181a1
JMF
13 'id': 'pKIGmG83AqD9',
14 'display_id': 'warcraft-trailer-1-561180739597',
bc0bb6fd 15 'ext': 'mp4',
d5c181a1
JMF
16 'title': 'Warcraft Trailer 1',
17 'description': 'Watch Trailer 1 from Warcraft (2016). Legendary’s WARCRAFT is a 3D epic adventure of world-colliding conflict based.',
bc0bb6fd
S
18 'thumbnail': 're:^https?://.*\.jpg$',
19 },
d5c181a1 20 'add_ie': ['ThePlatform'],
bc0bb6fd
S
21 }
22
23 def _real_extract(self, url):
d5c181a1 24 display_id = self._match_id(url)
bc0bb6fd 25
5c2266df 26 req = sanitized_Request(url)
d5c181a1
JMF
27 # it doesn't work if it thinks the browser it's too old
28 req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/43.0 (Chrome)')
29 webpage = self._download_webpage(req, display_id)
30 theplatform_link = self._html_search_regex(r'src="(http://player.theplatform.com/p/.*?)"', webpage, 'theplatform link')
31 title = self._html_search_regex(r'<title[^>]*>([^>]+)-\s*\d+\s*|\s*Movieclips.com</title>', webpage, 'title')
32 description = self._html_search_meta('description', webpage)
bc0bb6fd
S
33
34 return {
d5c181a1
JMF
35 '_type': 'url_transparent',
36 'url': theplatform_link,
bc0bb6fd 37 'title': title,
d5c181a1 38 'display_id': display_id,
bc0bb6fd 39 'description': description,
bc0bb6fd 40 }