]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spankbang.py
   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         'url': 'http://spankbang.com/1vt0/video/solvane+gangbang', 
  25         'only_matching': True, 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  32         stream_key 
= self
._html
_search
_regex
( 
  33             r
'''var\s+stream_key\s*=\s*['"](.+?)['"]''', 
  34             webpage
, 'stream key') 
  37             'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id
, stream_key
, height
), 
  39             'format_id': '%sp' % height
, 
  40             'height': int(height
), 
  41         } for height 
in re
.findall(r
'<(?:span|li|p)[^>]+[qb]_(\d+)p', webpage
)] 
  42         self
._check
_formats
(formats
, video_id
) 
  43         self
._sort
_formats
(formats
) 
  45         title 
= self
._html
_search
_regex
( 
  46             r
'(?s)<h1[^>]*>(.+?)</h1>', webpage
, 'title') 
  47         description 
= self
._search
_regex
( 
  48             r
'class="desc"[^>]*>([^<]+)', 
  49             webpage
, 'description', default
=None) 
  50         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  51         uploader 
= self
._search
_regex
( 
  52             r
'class="user"[^>]*>([^<]+)', 
  53             webpage
, 'uploader', fatal
=False) 
  55         age_limit 
= self
._rta
_search
(webpage
) 
  60             'description': description
, 
  61             'thumbnail': thumbnail
, 
  64             'age_limit': age_limit
,