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.

46 lines
1.3 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. import re
  2. from .common import InfoExtractor
  3. class RedTubeIE(InfoExtractor):
  4. _VALID_URL = r'(?:http://)?(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
  5. _TEST = {
  6. u'url': u'http://www.redtube.com/66418',
  7. u'file': u'66418.mp4',
  8. # md5 varies from time to time, as in
  9. # https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295
  10. #u'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
  11. u'info_dict': {
  12. u"title": u"Sucked on a toilet",
  13. u"age_limit": 18,
  14. }
  15. }
  16. def _real_extract(self, url):
  17. mobj = re.match(self._VALID_URL, url)
  18. video_id = mobj.group('id')
  19. video_extension = 'mp4'
  20. webpage = self._download_webpage(url, video_id)
  21. self.report_extraction(video_id)
  22. video_url = self._html_search_regex(
  23. r'<source src="(.+?)" type="video/mp4">', webpage, u'video URL')
  24. video_title = self._html_search_regex(
  25. r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
  26. webpage, u'title')
  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': video_extension,
  34. 'title': video_title,
  35. 'age_limit': age_limit,
  36. }