1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class GoshgayIE(InfoExtractor):
12 _VALID_URL = r'^(?:https?://)www.goshgay.com/video(?P<id>\d+?)($|/)'
14 'url': 'http://www.goshgay.com/video4116282',
15 'md5': '268b9f3c3229105c57859e166dd72b03',
19 'title': 'md5:089833a4790b5e103285a07337f245bf',
20 'thumbnail': 're:http://.*\.jpg',
25 def _real_extract(self, url):
26 video_id = self._match_id(url)
28 webpage = self._download_webpage(url, video_id)
29 title = self._og_search_title(webpage)
30 thumbnail = self._og_search_thumbnail(webpage)
31 family_friendly = self._html_search_meta(
32 'isFamilyFriendly', webpage, default='false')
33 config_url = self._search_regex(
34 r"'config'\s*:\s*'([^']+)'", webpage, 'config URL')
36 config = self._download_xml(
37 config_url, video_id, 'Downloading player config XML')
40 raise ExtractorError('Missing config XML')
41 if config.tag != 'config':
42 raise ExtractorError('Missing config attribute')
43 fns = config.findall('file')
45 raise ExtractorError('Missing media URI')
46 video_url = fns[0].text
48 url_comp = compat_urlparse.urlparse(url)
49 ref = "%s://%s%s" % (url_comp[0], url_comp[1], url_comp[2])
55 'thumbnail': thumbnail,
57 'age_limit': 0 if family_friendly == 'true' else 18,