1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 06:15:46 +00:00
youtube-dl/youtube_dl/extractor/goshgay.py

52 lines
1.5 KiB
Python
Raw Normal View History

2014-07-09 10:14:53 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import InfoExtractor
2014-12-12 11:55:13 +00:00
from ..compat import (
compat_parse_qs,
)
2014-07-09 10:14:53 +00:00
from ..utils import (
2014-12-12 11:55:13 +00:00
parse_duration,
2014-07-09 10:14:53 +00:00
)
class GoshgayIE(InfoExtractor):
2014-12-12 11:44:32 +00:00
_VALID_URL = r'https?://www\.goshgay\.com/video(?P<id>\d+?)($|/)'
2014-07-09 10:14:53 +00:00
_TEST = {
2014-12-12 11:55:13 +00:00
'url': 'http://www.goshgay.com/video299069/diesel_sfw_xxx_video',
'md5': '027fcc54459dff0feb0bc06a7aeda680',
2014-07-09 10:14:53 +00:00
'info_dict': {
2014-12-12 11:55:13 +00:00
'id': '299069',
2014-07-09 10:14:53 +00:00
'ext': 'flv',
2014-12-12 11:55:13 +00:00
'title': 'DIESEL SFW XXX Video',
'thumbnail': 're:^http://.*\.jpg$',
'duration': 79,
'age_limit': 18,
2014-07-09 10:14:53 +00:00
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
2014-07-09 10:14:53 +00:00
webpage = self._download_webpage(url, video_id)
2014-12-12 11:44:32 +00:00
2014-12-12 11:55:13 +00:00
title = self._html_search_regex(
r'<h2>(.*?)<', webpage, 'title')
duration = parse_duration(self._html_search_regex(
r'<span class="duration">\s*-?\s*(.*?)</span>',
webpage, 'duration', fatal=False))
2014-07-09 10:14:53 +00:00
2014-12-12 11:55:13 +00:00
flashvars = compat_parse_qs(self._html_search_regex(
r'<embed.+?id="flash-player-embed".+?flashvars="([^"]+)"',
webpage, 'flashvars'))
thumbnail = flashvars.get('url_bigthumb', [None])[0]
video_url = flashvars['flv_url'][0]
2014-07-09 10:14:53 +00:00
return {
'id': video_id,
'url': video_url,
'title': title,
'thumbnail': thumbnail,
2014-12-12 11:55:13 +00:00
'duration': duration,
'age_limit': self._family_friendly_search(webpage),
2014-07-09 10:14:53 +00:00
}