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.

37 lines
1.0 KiB

  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(r'<source src="(.+?)" type="video/mp4">',
  20. webpage, u'video URL')
  21. video_title = self._html_search_regex('<h1 class="videoTitle slidePanelMovable">(.+?)</h1>',
  22. webpage, u'title')
  23. return [{
  24. 'id': video_id,
  25. 'url': video_url,
  26. 'ext': video_extension,
  27. 'title': video_title,
  28. }]