]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rottentomatoes.py
Initiate new release.
[youtubedl] / youtube_dl / extractor / rottentomatoes.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..compat import compat_urlparse
5 from .internetvideoarchive import InternetVideoArchiveIE
6
7
8 class RottenTomatoesIE(InfoExtractor):
9 _VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
10
11 _TEST = {
12 'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
13 'info_dict': {
14 'id': '613340',
15 'ext': 'mp4',
16 'title': 'Toy Story 3',
17 },
18 }
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 }