]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/goshgay.py
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,