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