]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/goshgay.py
debian/changelog: Wrap long line.
[youtubedl] / youtube_dl / extractor / goshgay.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import (
6 compat_parse_qs,
7 )
8 from ..utils import (
9 parse_duration,
10 )
11
12
13 class GoshgayIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?goshgay\.com/video(?P<id>\d+?)($|/)'
15 _TEST = {
16 'url': 'http://www.goshgay.com/video299069/diesel_sfw_xxx_video',
17 'md5': '4b6db9a0a333142eb9f15913142b0ed1',
18 'info_dict': {
19 'id': '299069',
20 'ext': 'flv',
21 'title': 'DIESEL SFW XXX Video',
22 'thumbnail': r're:^http://.*\.jpg$',
23 'duration': 80,
24 'age_limit': 18,
25 }
26 }
27
28 def _real_extract(self, url):
29 video_id = self._match_id(url)
30 webpage = self._download_webpage(url, video_id)
31
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))
37
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]
43
44 return {
45 'id': video_id,
46 'url': video_url,
47 'title': title,
48 'thumbnail': thumbnail,
49 'duration': duration,
50 'age_limit': 18,
51 }