]>
Commit | Line | Data |
---|---|---|
1 | from .common import InfoExtractor | |
2 | from ..compat import ( | |
3 | compat_parse_qs, | |
4 | ) | |
5 | from ..utils import ( | |
6 | parse_duration, | |
7 | ) | |
8 | ||
9 | ||
10 | class GoshgayIE(InfoExtractor): | |
11 | _VALID_URL = r'https?://(?:www\.)?goshgay\.com/video(?P<id>\d+?)($|/)' | |
12 | _TEST = { | |
13 | 'url': 'http://www.goshgay.com/video299069/diesel_sfw_xxx_video', | |
14 | 'md5': '4b6db9a0a333142eb9f15913142b0ed1', | |
15 | 'info_dict': { | |
16 | 'id': '299069', | |
17 | 'ext': 'flv', | |
18 | 'title': 'DIESEL SFW XXX Video', | |
19 | 'thumbnail': r're:^http://.*\.jpg$', | |
20 | 'duration': 80, | |
21 | 'age_limit': 18, | |
22 | } | |
23 | } | |
24 | ||
25 | def _real_extract(self, url): | |
26 | video_id = self._match_id(url) | |
27 | webpage = self._download_webpage(url, video_id) | |
28 | ||
29 | title = self._html_search_regex( | |
30 | r'<h2>(.*?)<', webpage, 'title') | |
31 | duration = parse_duration(self._html_search_regex( | |
32 | r'<span class="duration">\s*-?\s*(.*?)</span>', | |
33 | webpage, 'duration', fatal=False)) | |
34 | ||
35 | flashvars = compat_parse_qs(self._html_search_regex( | |
36 | r'<embed.+?id="flash-player-embed".+?flashvars="([^"]+)"', | |
37 | webpage, 'flashvars')) | |
38 | thumbnail = flashvars.get('url_bigthumb', [None])[0] | |
39 | video_url = flashvars['flv_url'][0] | |
40 | ||
41 | return { | |
42 | 'id': video_id, | |
43 | 'url': video_url, | |
44 | 'title': title, | |
45 | 'thumbnail': thumbnail, | |
46 | 'duration': duration, | |
47 | 'age_limit': 18, | |
48 | } |