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.

38 lines
1.0 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. 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. return {
  25. 'id': video_id,
  26. 'url': video_url,
  27. 'ext': video_extension,
  28. 'title': video_title,
  29. }