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.

51 lines
1.4 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  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. 'file': '66418.mp4',
  9. # md5 varies from time to time, as in
  10. # https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295
  11. #'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
  12. 'info_dict': {
  13. "title": "Sucked on a toilet",
  14. "age_limit": 18,
  15. }
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. video_extension = 'mp4'
  21. webpage = self._download_webpage(url, video_id)
  22. self.report_extraction(video_id)
  23. video_url = self._html_search_regex(
  24. r'<source src="(.+?)" type="video/mp4">', webpage, u'video URL')
  25. video_title = self._html_search_regex(
  26. r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
  27. webpage, u'title')
  28. video_thumbnail = self._og_search_thumbnail(webpage)
  29. # No self-labeling, but they describe themselves as
  30. # "Home of Videos Porno"
  31. age_limit = 18
  32. return {
  33. 'id': video_id,
  34. 'url': video_url,
  35. 'ext': video_extension,
  36. 'title': video_title,
  37. 'thumbnail': video_thumbnail,
  38. 'age_limit': age_limit,
  39. }