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.

52 lines
1.7 KiB

  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. compat_urllib_parse,
  5. unified_strdate,
  6. )
  7. class PornotubeIE(InfoExtractor):
  8. _VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$'
  9. _TEST = {
  10. u'url': u'http://pornotube.com/c/173/m/1689755/Marilyn-Monroe-Bathing',
  11. u'file': u'1689755.flv',
  12. u'md5': u'374dd6dcedd24234453b295209aa69b6',
  13. u'info_dict': {
  14. u"upload_date": u"20090708",
  15. u"title": u"Marilyn-Monroe-Bathing"
  16. }
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('videoid')
  21. video_title = mobj.group('title')
  22. # Get webpage content
  23. webpage = self._download_webpage(url, video_id)
  24. # Get the video URL
  25. VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",'
  26. video_url = self._search_regex(VIDEO_URL_RE, webpage, u'video url')
  27. video_url = compat_urllib_parse.unquote(video_url)
  28. #Get the uploaded date
  29. VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by'
  30. upload_date = self._html_search_regex(VIDEO_UPLOADED_RE, webpage, u'upload date', fatal=False)
  31. if upload_date: upload_date = unified_strdate(upload_date)
  32. age_limit = self._rta_search(webpage)
  33. info = {'id': video_id,
  34. 'url': video_url,
  35. 'uploader': None,
  36. 'upload_date': upload_date,
  37. 'title': video_title,
  38. 'ext': 'flv',
  39. 'format': 'flv',
  40. 'age_limit': age_limit}
  41. return [info]