]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/eporner.py
bb231ecb1cd81577d41c9c16ec3e0156c4abcf3e
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class EpornerIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?eporner\.com/hd-porn/(?P<id>\d+)/(?P<display_id>[\w-]+)' 
  16         'url': 'http://www.eporner.com/hd-porn/95008/Infamous-Tiffany-Teen-Strip-Tease-Video/', 
  17         'md5': '39d486f046212d8e1b911c52ab4691f8', 
  20             'display_id': 'Infamous-Tiffany-Teen-Strip-Tease-Video', 
  22             'title': 'Infamous Tiffany Teen Strip Tease Video', 
  29     def _real_extract(self
, url
): 
  30         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  31         video_id 
= mobj
.group('id') 
  32         display_id 
= mobj
.group('display_id') 
  34         webpage 
= self
._download
_webpage
(url
, display_id
) 
  35         title 
= self
._html
_search
_regex
( 
  36             r
'<title>(.*?) - EPORNER', webpage
, 'title') 
  38         redirect_code 
= self
._html
_search
_regex
( 
  39             r
'<script type="text/javascript" src="/config5/%s/([a-f\d]+)/">' % video_id
, 
  40             webpage
, 'redirect_code') 
  41         redirect_url 
= 'http://www.eporner.com/config5/%s/%s' % (video_id
, redirect_code
) 
  42         player_code 
= self
._download
_webpage
( 
  43             redirect_url
, display_id
, note
='Downloading player config') 
  45         sources 
= self
._search
_regex
( 
  46             r
'(?s)sources\s*:\s*\[\s*({.+?})\s*\]', player_code
, 'sources') 
  49         for video_url
, format_id 
in re
.findall(r
'file\s*:\s*"([^"]+)",\s*label\s*:\s*"([^"]+)"', sources
): 
  52                 'format_id': format_id
, 
  54             m 
= re
.search(r
'^(\d+)', format_id
) 
  56                 fmt
['height'] = int(m
.group(1)) 
  58         self
._sort
_formats
(formats
) 
  60         duration 
= parse_duration(self
._search
_regex
( 
  61             r
'class="mbtim">([0-9:]+)</div>', webpage
, 'duration', 
  63         view_count 
= str_to_int(self
._search
_regex
( 
  64             r
'id="cinemaviews">\s*([0-9,]+)\s*<small>views', 
  65             webpage
, 'view count', fatal
=False)) 
  69             'display_id': display_id
, 
  72             'view_count': view_count
, 
  74             'age_limit': self
._rta
_search
(webpage
),