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.

56 lines
1.7 KiB

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