]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/foxgay.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class FoxgayIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml'
16 'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml',
17 'md5': '344558ccfea74d33b7adbce22e577f54',
21 'title': 'Fuck Turkish-style',
22 'description': 'md5:6ae2d9486921891efe89231ace13ffdf',
24 'thumbnail': r
're:https?://.*\.jpg$',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
32 title
= remove_end(self
._html
_search
_regex
(
33 r
'<title>([^<]+)</title>', webpage
, 'title'), ' - Foxgay.com')
34 description
= get_element_by_id('inf_tit', webpage
)
36 # The default user-agent with foxgay cookies leads to pages without videos
37 self
._downloader
.cookiejar
.clear('.foxgay.com')
38 # Find the URL for the iFrame which contains the actual video.
39 iframe_url
= self
._html
_search
_regex
(
40 r
'<iframe[^>]+src=([\'"])(?P<url>[^\'"]+)\
1', webpage,
41 'video frame
', group='url
')
42 iframe = self._download_webpage(
43 iframe_url, video_id, headers={'User
-Agent
': 'curl
/7.50.1'},
44 note='Downloading video frame
')
45 video_data = self._parse_json(self._search_regex(
46 r'video_data\s
*=\s
*([^
;]+);', iframe, 'video data
'), video_id)
50 'height
': int_or_none(resolution),
51 } for source, resolution in zip(
52 video_data['sources
'], video_data.get('resolutions
', itertools.repeat(None)))]
54 self._sort_formats(formats)
60 'description
': description,
61 'thumbnail
': video_data.get('act_vid
', {}).get('thumb
'),