]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xnxx.py
Prepare for upload.
[youtubedl] / youtube_dl / extractor / xnxx.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import (
6 compat_urllib_parse,
7 )
8
9
10 class XNXXIE(InfoExtractor):
11 _VALID_URL = r'^https?://(?:video|www)\.xnxx\.com/video(?P<id>[0-9]+)/(.*)'
12 _TEST = {
13 'url': 'http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_',
14 'md5': '0831677e2b4761795f68d417e0b7b445',
15 'info_dict': {
16 'id': '1135332',
17 'ext': 'flv',
18 'title': 'lida » Naked Funny Actress (5)',
19 'age_limit': 18,
20 }
21 }
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25 webpage = self._download_webpage(url, video_id)
26
27 video_url = self._search_regex(r'flv_url=(.*?)&amp;',
28 webpage, 'video URL')
29 video_url = compat_urllib_parse.unquote(video_url)
30
31 video_title = self._html_search_regex(r'<title>(.*?)\s+-\s+XNXX.COM',
32 webpage, 'title')
33
34 video_thumbnail = self._search_regex(r'url_bigthumb=(.*?)&amp;',
35 webpage, 'thumbnail', fatal=False)
36
37 return {
38 'id': video_id,
39 'url': video_url,
40 'title': video_title,
41 'ext': 'flv',
42 'thumbnail': video_thumbnail,
43 'age_limit': 18,
44 }