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.

58 lines
2.0 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. 'age_limit': 18,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. video_id = mobj.group('id')
  26. webpage = self._download_webpage(url, video_id)
  27. title = self._html_search_regex(
  28. r'<title>(.*?) - EPORNER', webpage, 'title')
  29. redirect_code = self._html_search_regex(
  30. r'<script type="text/javascript" src="/config5/%s/([a-f\d]+)/">' % video_id,
  31. webpage, 'redirect_code')
  32. redirect_url = 'http://www.eporner.com/config5/%s/%s' % (video_id, redirect_code)
  33. player_code = self._download_webpage(
  34. redirect_url, video_id, note='Downloading player config')
  35. video_url = self._html_search_regex(
  36. r'file: "(.*?)",', player_code, 'video_url')
  37. duration = parse_duration(self._search_regex(
  38. r'class="mbtim">([0-9:]+)</div>', webpage, 'duration',
  39. fatal=False))
  40. view_count = str_to_int(self._search_regex(
  41. r'id="cinemaviews">\s*([0-9,]+)\s*<small>views',
  42. webpage, 'view count', fatal=False))
  43. return {
  44. 'id': video_id,
  45. 'url': video_url,
  46. 'title': title,
  47. 'duration': duration,
  48. 'view_count': view_count,
  49. 'age_limit': self._rta_search(webpage),
  50. }