]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/rottentomatoes.py
add multi_video test case
[yt-dlp.git] / youtube_dl / extractor / rottentomatoes.py
CommitLineData
924f47f7
PH
1from __future__ import unicode_literals
2
dae2a058
YCH
3from .common import InfoExtractor
4from ..compat import compat_urlparse
5from .internetvideoarchive import InternetVideoArchiveIE
4b7b839f
JMF
6
7
dae2a058 8class RottenTomatoesIE(InfoExtractor):
4b7b839f
JMF
9 _VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
10
11 _TEST = {
924f47f7 12 'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
924f47f7 13 'info_dict': {
96aded8d
PH
14 'id': '613340',
15 'ext': 'mp4',
dae2a058 16 'title': 'Toy Story 3',
4b7b839f
JMF
17 },
18 }
dae2a058
YCH
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
23 og_video = self._og_search_video_url(webpage)
24 query = compat_urlparse.urlparse(og_video).query
25
26 return {
27 '_type': 'url_transparent',
28 'url': InternetVideoArchiveIE._build_xml_url(query),
29 'ie_key': InternetVideoArchiveIE.ie_key(),
30 'title': self._og_search_title(webpage),
31 }