You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1001 B

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..compat import compat_urlparse
  4. from .internetvideoarchive import InternetVideoArchiveIE
  5. class RottenTomatoesIE(InfoExtractor):
  6. _VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
  9. 'info_dict': {
  10. 'id': '613340',
  11. 'ext': 'mp4',
  12. 'title': 'Toy Story 3',
  13. },
  14. }
  15. def _real_extract(self, url):
  16. video_id = self._match_id(url)
  17. webpage = self._download_webpage(url, video_id)
  18. og_video = self._og_search_video_url(webpage)
  19. query = compat_urlparse.urlparse(og_video).query
  20. return {
  21. '_type': 'url_transparent',
  22. 'url': InternetVideoArchiveIE._build_xml_url(query),
  23. 'ie_key': InternetVideoArchiveIE.ie_key(),
  24. 'title': self._og_search_title(webpage),
  25. }