redtube.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. u'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
  9. u'info_dict': {
  10. u"title": u"Sucked on a toilet"
  11. }
  12. }
  13. def _real_extract(self, url):
  14. mobj = re.match(self._VALID_URL, url)
  15. video_id = mobj.group('id')
  16. video_extension = 'mp4'
  17. webpage = self._download_webpage(url, video_id)
  18. self.report_extraction(video_id)
  19. video_url = self._html_search_regex(
  20. r'<source src="(.+?)" type="video/mp4">', webpage, u'video URL')
  21. video_title = self._html_search_regex(
  22. r'<h1 class="videoTitle slidePanelMovable">(.+?)</h1>',
  23. webpage, u'title')
  24. # No self-labeling, but they describe themselves as
  25. # "Home of Videos Porno"
  26. age_limit = 18
  27. return {
  28. 'id': video_id,
  29. 'url': video_url,
  30. 'ext': video_extension,
  31. 'title': video_title,
  32. 'age_limit': age_limit,
  33. }