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.

55 lines
1.8 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. parse_duration,
  7. str_to_int,
  8. )
  9. class EpornerIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?eporner\.com/hd-porn/(?P<id>\d+)/(?P<title_dash>[\w-]+)/?'
  11. _TEST = {
  12. 'url': 'http://www.eporner.com/hd-porn/95008/Infamous-Tiffany-Teen-Strip-Tease-Video/',
  13. 'md5': '3b427ae4b9d60619106de3185c2987cd',
  14. 'info_dict': {
  15. 'id': '95008',
  16. 'ext': 'flv',
  17. 'title': 'Infamous Tiffany Teen Strip Tease Video',
  18. 'duration': 194,
  19. 'view_count': int,
  20. }
  21. }
  22. def _real_extract(self, url):
  23. mobj = re.match(self._VALID_URL, url)
  24. video_id = mobj.group('id')
  25. webpage = self._download_webpage(url, video_id)
  26. title = self._html_search_regex(
  27. r'<title>(.*?) - EPORNER', webpage, 'title')
  28. redirect_code = self._html_search_regex(
  29. r'<script type="text/javascript" src="/config5/%s/([a-f\d]+)/">' % video_id,
  30. webpage, 'redirect_code')
  31. redirect_url = 'http://www.eporner.com/config5/%s/%s' % (video_id, redirect_code)
  32. webpage2 = self._download_webpage(redirect_url, video_id)
  33. video_url = self._html_search_regex(
  34. r'file: "(.*?)",', webpage2, 'video_url')
  35. duration = parse_duration(self._search_regex(
  36. r'class="mbtim">([0-9:]+)</div>', webpage, 'duration',
  37. fatal=False))
  38. view_count = str_to_int(self._search_regex(
  39. r'id="cinemaviews">\s*([0-9,]+)\s*<small>views',
  40. webpage, 'view count', fatal=False))
  41. return {
  42. 'id': video_id,
  43. 'url': video_url,
  44. 'title': title,
  45. 'duration': duration,
  46. 'view_count': view_count,
  47. }