]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/goshgay.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / goshgay.py
CommitLineData
d6aa1967 1from .common import InfoExtractor
82b34105
PH
2from ..compat import (
3 compat_parse_qs,
4)
d6aa1967 5from ..utils import (
82b34105 6 parse_duration,
d6aa1967 7)
d6aa1967
M
8
9
10class GoshgayIE(InfoExtractor):
92519402 11 _VALID_URL = r'https?://(?:www\.)?goshgay\.com/video(?P<id>\d+?)($|/)'
d6aa1967 12 _TEST = {
82b34105 13 'url': 'http://www.goshgay.com/video299069/diesel_sfw_xxx_video',
12355ac4 14 'md5': '4b6db9a0a333142eb9f15913142b0ed1',
d6aa1967 15 'info_dict': {
82b34105 16 'id': '299069',
d6aa1967 17 'ext': 'flv',
82b34105 18 'title': 'DIESEL SFW XXX Video',
ec85ded8 19 'thumbnail': r're:^http://.*\.jpg$',
12355ac4 20 'duration': 80,
3dfd25b3 21 'age_limit': 18,
d6aa1967
M
22 }
23 }
24
25 def _real_extract(self, url):
5d63b0aa 26 video_id = self._match_id(url)
d6aa1967 27 webpage = self._download_webpage(url, video_id)
73aeb2dc 28
82b34105
PH
29 title = self._html_search_regex(
30 r'<h2>(.*?)<', webpage, 'title')
31 duration = parse_duration(self._html_search_regex(
32 r'<span class="duration">\s*-?\s*(.*?)</span>',
33 webpage, 'duration', fatal=False))
d6aa1967 34
82b34105
PH
35 flashvars = compat_parse_qs(self._html_search_regex(
36 r'<embed.+?id="flash-player-embed".+?flashvars="([^"]+)"',
37 webpage, 'flashvars'))
38 thumbnail = flashvars.get('url_bigthumb', [None])[0]
39 video_url = flashvars['flv_url'][0]
d6aa1967
M
40
41 return {
42 'id': video_id,
43 'url': video_url,
44 'title': title,
d6aa1967 45 'thumbnail': thumbnail,
82b34105 46 'duration': duration,
12355ac4 47 'age_limit': 18,
d6aa1967 48 }