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.

53 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. u"age_limit": 18
  17. }
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. video_id = mobj.group('videoid')
  22. video_title = mobj.group('title')
  23. # Get webpage content
  24. webpage = self._download_webpage(url, video_id)
  25. # Get the video URL
  26. VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",'
  27. video_url = self._search_regex(VIDEO_URL_RE, webpage, u'video url')
  28. video_url = compat_urllib_parse.unquote(video_url)
  29. #Get the uploaded date
  30. VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by'
  31. upload_date = self._html_search_regex(VIDEO_UPLOADED_RE, webpage, u'upload date', fatal=False)
  32. if upload_date: upload_date = unified_strdate(upload_date)
  33. age_limit = self._rta_search(webpage)
  34. info = {'id': video_id,
  35. 'url': video_url,
  36. 'uploader': None,
  37. 'upload_date': upload_date,
  38. 'title': video_title,
  39. 'ext': 'flv',
  40. 'format': 'flv',
  41. 'age_limit': age_limit}
  42. return [info]