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.

45 lines
1.4 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import ExtractorError
  4. class RedTubeIE(InfoExtractor):
  5. _VALID_URL = r'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
  6. _TEST = {
  7. 'url': 'http://www.redtube.com/66418',
  8. 'md5': '7b8c22b5e7098a3e1c09709df1126d2d',
  9. 'info_dict': {
  10. 'id': '66418',
  11. 'ext': 'mp4',
  12. 'title': 'Sucked on a toilet',
  13. 'age_limit': 18,
  14. }
  15. }
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. if any(s in webpage for s in ['video-deleted-info', '>This video has been removed']):
  20. raise ExtractorError('Video %s has been removed' % video_id, expected=True)
  21. video_url = self._html_search_regex(
  22. r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
  23. video_title = self._html_search_regex(
  24. r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
  25. webpage, 'title')
  26. video_thumbnail = self._og_search_thumbnail(webpage)
  27. # No self-labeling, but they describe themselves as
  28. # "Home of Videos Porno"
  29. age_limit = 18
  30. return {
  31. 'id': video_id,
  32. 'url': video_url,
  33. 'ext': 'mp4',
  34. 'title': video_title,
  35. 'thumbnail': video_thumbnail,
  36. 'age_limit': age_limit,
  37. }