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.

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