]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hellporno.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  13 class HellPornoIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P<id>[^/]+)' 
  16         'url': 'http://hellporno.com/videos/dixie-is-posing-with-naked-ass-very-erotic/', 
  17         'md5': '1fee339c610d2049699ef2aa699439f1', 
  20             'display_id': 'dixie-is-posing-with-naked-ass-very-erotic', 
  22             'title': 'Dixie is posing with naked ass very erotic', 
  23             'thumbnail': r
're:https?://.*\.jpg$', 
  27         'url': 'http://hellporno.net/v/186271/', 
  28         'only_matching': True, 
  31     def _real_extract(self
, url
): 
  32         display_id 
= self
._match
_id
(url
) 
  34         webpage 
= self
._download
_webpage
(url
, display_id
) 
  36         title 
= remove_end(self
._html
_search
_regex
( 
  37             r
'<title>([^<]+)</title>', webpage
, 'title'), ' - Hell Porno') 
  39         flashvars 
= self
._parse
_json
(self
._search
_regex
( 
  40             r
'var\s+flashvars\s*=\s*({.+?});', webpage
, 'flashvars'), 
  41             display_id
, transform_source
=js_to_json
) 
  43         video_id 
= flashvars
.get('video_id') 
  44         thumbnail 
= flashvars
.get('preview_url') 
  45         ext 
= determine_ext(flashvars
.get('postfix'), 'mp4') 
  48         for video_url_key 
in ['video_url', 'video_alt_url']: 
  49             video_url 
= flashvars
.get(video_url_key
) 
  52             video_text 
= flashvars
.get('%s_text' % video_url_key
) 
  56                 'format_id': video_text
, 
  58             m 
= re
.search(r
'^(?P<height>\d+)[pP]', video_text
) 
  60                 fmt
['height'] = int(m
.group('height')) 
  62         self
._sort
_formats
(formats
) 
  64         categories 
= self
._html
_search
_meta
( 
  65             'keywords', webpage
, 'categories', default
='').split(',') 
  69             'display_id': display_id
, 
  71             'thumbnail': thumbnail
, 
  72             'categories': categories
,