]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/xnxx.py
Merge remote-tracking branch 'h-collector/master'
[yt-dlp.git] / youtube_dl / extractor / xnxx.py
CommitLineData
bdebf51c
JMF
1# encoding: utf-8
2from __future__ import unicode_literals
3
570fa151 4from .common import InfoExtractor
1cc79574 5from ..compat import (
570fa151 6 compat_urllib_parse,
570fa151
PH
7)
8
9
10class XNXXIE(InfoExtractor):
bdebf51c 11 _VALID_URL = r'^https?://(?:video|www)\.xnxx\.com/video(?P<id>[0-9]+)/(.*)'
6f5ac90c 12 _TEST = {
bdebf51c
JMF
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,
6f5ac90c
PH
20 }
21 }
570fa151
PH
22
23 def _real_extract(self, url):
1cc79574 24 video_id = self._match_id(url)
570fa151
PH
25 webpage = self._download_webpage(url, video_id)
26
bdebf51c 27 video_url = self._search_regex(r'flv_url=(.*?)&amp;',
9e1a5b84 28 webpage, 'video URL')
570fa151
PH
29 video_url = compat_urllib_parse.unquote(video_url)
30
bdebf51c 31 video_title = self._html_search_regex(r'<title>(.*?)\s+-\s+XNXX.COM',
9e1a5b84 32 webpage, 'title')
570fa151 33
bdebf51c 34 video_thumbnail = self._search_regex(r'url_bigthumb=(.*?)&amp;',
9e1a5b84 35 webpage, 'thumbnail', fatal=False)
570fa151 36
bdebf51c 37 return {
570fa151
PH
38 'id': video_id,
39 'url': video_url,
570fa151
PH
40 'title': video_title,
41 'ext': 'flv',
42 'thumbnail': video_thumbnail,
8e590a11 43 'age_limit': 18,
bdebf51c 44 }