From b92c54869345b60a29882297ac1832429f964d03 Mon Sep 17 00:00:00 2001 From: Zack Fernandes Date: Wed, 3 Dec 2014 20:22:48 -0800 Subject: [PATCH] [foxgay] Initial support --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/foxgay.py | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 youtube_dl/extractor/foxgay.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 8b513ffd1d..b2c7fd5865 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -121,6 +121,7 @@ from .flickr import FlickrIE from .folketinget import FolketingetIE from .fourtube import FourTubeIE +from .foxgay import FoxgayIE from .franceculture import FranceCultureIE from .franceinter import FranceInterIE from .francetv import ( diff --git a/youtube_dl/extractor/foxgay.py b/youtube_dl/extractor/foxgay.py new file mode 100644 index 0000000000..a146a91802 --- /dev/null +++ b/youtube_dl/extractor/foxgay.py @@ -0,0 +1,48 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class FoxgayIE(InfoExtractor): + _VALID_URL = r'http://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P\d+)\.shtml' + _TEST = { + 'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml', + 'md5': '80d72beab5d04e1655a56ad37afe6841', + 'info_dict': { + 'id': '2582', + 'ext': 'mp4', + 'title': 'md5:6122f7ae0fc6b21ebdf59c5e083ce25a', + 'description': 'md5:5e51dc4405f1fd315f7927daed2ce5cf', + 'age_limit': 18, + }, + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + # Download the initial webpage and extract all available data. + webpage = self._download_webpage(url, video_id) + title = self._html_search_regex( + r'(?P<title>.*?)', + webpage, 'title', fatal=False) + description = self._html_search_regex( + r'

(?P.*?)

', + webpage, 'description', fatal=False) + + # Find the URL for the iFrame which contains the actual video. + iframe = self._download_webpage( + self._html_search_regex(r'iframe src="(?P.*?)"', webpage, 'video frame'), + video_id) + video_url = self._html_search_regex( + r"v_path = '(?Phttp://.*?)'", iframe, 'url') + thumb_url = self._html_search_regex( + r"t_path = '(?Phttp://.*?)'", iframe, 'thumbnail', fatal=False) + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'description': description, + 'thumbnail': thumb_url, + 'age_limit': 18, + }