]>
Commit | Line | Data |
---|---|---|
64102296 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | import re | |
6 | ||
7 | class SpankBangIE(InfoExtractor): | |
8 | """Extractor for http://spankbang.com""" | |
9 | ||
10 | _VALID_URL = r"https?://(?:www\.)?spankbang\.com/(?P<id>\w+)/video/.*" | |
5c1d459a | 11 | |
12 | _TEST = { | |
13 | "url": "http://spankbang.com/3vvn/video/fantasy+solo", | |
14 | "md5": "1cc433e1d6aa14bc376535b8679302f7", | |
15 | "info_dict": { | |
16 | "id": "3vvn", | |
17 | "title": "fantasy solo", | |
18 | "description": "Watch fantasy solo free HD porn video - 05 minutes - dillion harper masturbates on a bed free adult movies.", | |
19 | "format": "720p", | |
20 | "format_id": "720p", | |
21 | "ext": "mp4", | |
c7ac5dce | 22 | "url": "http://spankbang.com/_3vvn/IjE0MjgyNjY5MTcuMzUi.IaGrcF-vDrvktMhjd-1fWixiCzU/title/720p__mp4" |
5c1d459a | 23 | } |
24 | } | |
64102296 | 25 | |
26 | def _real_extract(self, url): | |
27 | video_id = self._match_id(url) | |
28 | webpage = self._download_webpage(url, video_id) | |
29 | ||
30 | title = self._html_search_regex(r"<h1>(?:<img.+?>)?(.*?)</h1>", webpage, "title") | |
31 | ||
32 | stream_key = self._html_search_regex(r"""var\s+stream_key\s*[=]\s*['"](.+?)['"]\s*;""", webpage, "stream_key") | |
33 | ||
34 | qualities = re.findall(r"<span.+?>([0-9]+p).*?</span>", webpage) | |
35 | ||
36 | formats = [] | |
37 | for q in sorted(qualities): | |
38 | formats.append({ | |
39 | "format_id": q, | |
40 | "format": q, | |
41 | "ext": "mp4", | |
2e7daef5 | 42 | "url": "http://spankbang.com/_{0}/{1}/title/{2}__mp4".format(video_id, stream_key, q) |
64102296 | 43 | }) |
44 | ||
45 | return { | |
46 | "id": video_id, | |
47 | "title": title, | |
48 | "description": self._og_search_description(webpage), | |
49 | "formats": formats | |
50 | } | |
51 | ||
52 | # vim: tabstop=4 expandtab |