]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spankbang.py
7f060b15b69908a71ff45a44f13e92ab0089ff5b
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class SpankBangIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:(?:www|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video' 
  11         'url': 'http://spankbang.com/3vvn/video/fantasy+solo', 
  12         'md5': '1cc433e1d6aa14bc376535b8679302f7', 
  16             'title': 'fantasy solo', 
  17             'description': 'dillion harper masturbates on a bed', 
  18             'thumbnail': 're:^https?://.*\.jpg$', 
  19             'uploader': 'silly2587', 
  24     def _real_extract(self
, url
): 
  25         video_id 
= self
._match
_id
(url
) 
  26         webpage 
= self
._download
_webpage
(url
, video_id
) 
  28         stream_key 
= self
._html
_search
_regex
( 
  29             r
'''var\s+stream_key\s*=\s*['"](.+?)['"]''', 
  30             webpage
, 'stream key') 
  33             'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id
, stream_key
, height
), 
  35             'format_id': '%sp' % height
, 
  36             'height': int(height
), 
  37         } for height 
in re
.findall(r
'<span[^>]+q_(\d+)p', webpage
)] 
  38         self
._sort
_formats
(formats
) 
  40         title 
= self
._html
_search
_regex
( 
  41             r
'(?s)<h1>(.+?)</h1>', webpage
, 'title') 
  42         description 
= self
._search
_regex
( 
  43             r
'class="desc"[^>]*>([^<]+)', 
  44             webpage
, 'description', default
=None) 
  45         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  46         uploader 
= self
._search
_regex
( 
  47             r
'class="user"[^>]*>([^<]+)', 
  48             webpage
, 'uploader', fatal
=False) 
  50         age_limit 
= self
._rta
_search
(webpage
) 
  55             'description': description
, 
  56             'thumbnail': thumbnail
, 
  59             'age_limit': age_limit
,