]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xnxx.py
Prepare new release.
[youtubedl] / youtube_dl / extractor / xnxx.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import compat_urllib_parse_unquote
6
7
8 class XNXXIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:video|www)\.xnxx\.com/video-?(?P<id>[0-9a-z]+)/'
10 _TESTS = [{
11 'url': 'http://www.xnxx.com/video-55awb78/skyrim_test_video',
12 'md5': 'ef7ecee5af78f8b03dca2cf31341d3a0',
13 'info_dict': {
14 'id': '55awb78',
15 'ext': 'flv',
16 'title': 'Skyrim Test Video',
17 'age_limit': 18,
18 },
19 }, {
20 'url': 'http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_',
21 'only_matching': True,
22 }, {
23 'url': 'http://www.xnxx.com/video-55awb78/',
24 'only_matching': True,
25 }]
26
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29 webpage = self._download_webpage(url, video_id)
30
31 video_url = self._search_regex(r'flv_url=(.*?)&amp;',
32 webpage, 'video URL')
33 video_url = compat_urllib_parse_unquote(video_url)
34
35 video_title = self._html_search_regex(r'<title>(.*?)\s+-\s+XNXX.COM',
36 webpage, 'title')
37
38 video_thumbnail = self._search_regex(r'url_bigthumb=(.*?)&amp;',
39 webpage, 'thumbnail', fatal=False)
40
41 return {
42 'id': video_id,
43 'url': video_url,
44 'title': video_title,
45 'ext': 'flv',
46 'thumbnail': video_thumbnail,
47 'age_limit': 18,
48 }