]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/foxgay.py
debian/copyright: Fix lintian's dep5-copyright-license-name-not-unique.
[youtubedl] / youtube_dl / extractor / foxgay.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class FoxgayIE(InfoExtractor):
7 _VALID_URL = r'http://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml'
8 _TEST = {
9 'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml',
10 'md5': '80d72beab5d04e1655a56ad37afe6841',
11 'info_dict': {
12 'id': '2582',
13 'ext': 'mp4',
14 'title': 'md5:6122f7ae0fc6b21ebdf59c5e083ce25a',
15 'description': 'md5:5e51dc4405f1fd315f7927daed2ce5cf',
16 'age_limit': 18,
17 'thumbnail': 're:https?://.*\.jpg$',
18 },
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage(url, video_id)
24
25 title = self._html_search_regex(
26 r'<title>(?P<title>.*?)</title>',
27 webpage, 'title', fatal=False)
28 description = self._html_search_regex(
29 r'<div class="ico_desc"><h2>(?P<description>.*?)</h2>',
30 webpage, 'description', fatal=False)
31
32 # Find the URL for the iFrame which contains the actual video.
33 iframe = self._download_webpage(
34 self._html_search_regex(r'iframe src="(?P<frame>.*?)"', webpage, 'video frame'),
35 video_id)
36 video_url = self._html_search_regex(
37 r"v_path = '(?P<vid>http://.*?)'", iframe, 'url')
38 thumb_url = self._html_search_regex(
39 r"t_path = '(?P<thumb>http://.*?)'", iframe, 'thumbnail', fatal=False)
40
41 return {
42 'id': video_id,
43 'title': title,
44 'url': video_url,
45 'description': description,
46 'thumbnail': thumb_url,
47 'age_limit': 18,
48 }