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