]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/foxgay.py
3 from .common
import InfoExtractor
11 class FoxgayIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml'
14 'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml',
15 'md5': '344558ccfea74d33b7adbce22e577f54',
19 'title': 'Fuck Turkish-style',
20 'description': 'md5:6ae2d9486921891efe89231ace13ffdf',
22 'thumbnail': r
're:https?://.*\.jpg$',
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
28 webpage
= self
._download
_webpage
(url
, video_id
)
30 title
= remove_end(self
._html
_extract
_title
(webpage
), ' - Foxgay.com')
31 description
= get_element_by_id('inf_tit', webpage
)
33 # The default user-agent with foxgay cookies leads to pages without videos
34 self
._downloader
.cookiejar
.clear('.foxgay.com')
35 # Find the URL for the iFrame which contains the actual video.
36 iframe_url
= self
._html
_search
_regex
(
37 r
'<iframe[^>]+src=([\'"])(?P<url>[^\'"]+)\
1', webpage,
38 'video frame
', group='url
')
39 iframe = self._download_webpage(
40 iframe_url, video_id, headers={'User-Agent': 'curl/7.50.1'},
41 note='Downloading video frame
')
42 video_data = self._parse_json(self._search_regex(
43 r'video_data\s
*=\s
*([^
;]+);', iframe, 'video data
'), video_id)
47 'height
': int_or_none(resolution),
48 } for source, resolution in zip(
49 video_data['sources
'], video_data.get('resolutions
', itertools.repeat(None)))]
51 self._sort_formats(formats)
57 'description
': description,
58 'thumbnail
': video_data.get('act_vid
', {}).get('thumb
'),