[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / rottentomatoes.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from .internetvideoarchive import InternetVideoArchiveIE
5
6
7 class RottenTomatoesIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
9
10     _TEST = {
11         'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
12         'info_dict': {
13             'id': '11028566',
14             'ext': 'mp4',
15             'title': 'Toy Story 3',
16             'description': 'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.',
17             'thumbnail': r're:^https?://.*\.jpg$',
18         },
19     }
20
21     def _real_extract(self, url):
22         video_id = self._match_id(url)
23         webpage = self._download_webpage(url, video_id)
24         iva_id = self._search_regex(r'publishedid=(\d+)', webpage, 'internet video archive id')
25
26         return {
27             '_type': 'url_transparent',
28             'url': 'http://video.internetvideoarchive.net/player/6/configuration.ashx?domain=www.videodetective.com&customerid=69249&playerid=641&publishedid=' + iva_id,
29             'ie_key': InternetVideoArchiveIE.ie_key(),
30             'id': video_id,
31             'title': self._og_search_title(webpage),
32         }