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