]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spankbang.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class SpankBangIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:(?:www|m|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
17 'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
18 'md5': '1cc433e1d6aa14bc376535b8679302f7',
22 'title': 'fantasy solo',
23 'description': 'dillion harper masturbates on a bed',
24 'thumbnail': r
're:^https?://.*\.jpg$',
25 'uploader': 'silly2587',
30 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
31 'only_matching': True,
34 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
35 'only_matching': True,
38 'url': 'http://m.spankbang.com/1o2de/video/can+t+remember+her+name',
39 'only_matching': True,
42 'url': 'https://spankbang.com/1vwqx/video/jade+kush+solo+4k',
43 'only_matching': True,
46 def _real_extract(self
, url
):
47 video_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, video_id
, headers
={
49 'Cookie': 'country=US'
52 if re
.search(r
'<[^>]+\bid=["\']video_removed
', webpage):
54 'Video
%s is not available
' % video_id, expected=True)
57 for mobj in re.finditer(
58 r'stream_url_(?P
<id>[^\s
=]+)\s
*=\s
*(["\'])(?P<url>(?:(?!\2).)+)\2',
60 format_id, format_url = mobj.group('id', 'url')
61 f = parse_resolution(format_id)
64 'format_id': format_id,
67 self._sort_formats(formats)
69 title = self._html_search_regex(
70 r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
71 description = self._search_regex(
72 r'<div[^>]+\bclass=["\']bottom
[^
>]+>\s
*<p
>[^
<]*</p
>\s
*<p
>([^
<]+)',
73 webpage, 'description
', fatal=False)
74 thumbnail = self._og_search_thumbnail(webpage)
75 uploader = self._search_regex(
76 r'class="user"[^
>]*><img
[^
>]+>([^
<]+)',
77 webpage, 'uploader
', default=None)
78 duration = parse_duration(self._search_regex(
79 r'<div
[^
>]+\bclass
=["\']right_side[^>]+>\s*<span>([^<]+)',
80 webpage, 'duration', fatal=False))
81 view_count = str_to_int(self._search_regex(
82 r'([\d,.]+)\s+plays', webpage, 'view count', fatal=False))
84 age_limit = self._rta_search(webpage)
89 'description': description,
90 'thumbnail': thumbnail,
93 'view_count': view_count,
95 'age_limit': age_limit,