]>
Commit | Line | Data |
---|---|---|
5f6a1245 | 1 | # coding: utf-8 |
fa7df757 | 2 | from __future__ import unicode_literals |
466de688 PH |
3 | |
4 | import re | |
5 | ||
a4a554a7 | 6 | from .common import InfoExtractor |
d8dbf870 | 7 | from ..utils import remove_end |
fa7df757 | 8 | |
466de688 | 9 | |
a4a554a7 | 10 | class ThisAVIE(InfoExtractor): |
466de688 | 11 | _VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*' |
584d6f34 | 12 | _TESTS = [{ |
a2e32866 | 13 | # jwplayer |
fa7df757 S |
14 | 'url': 'http://www.thisav.com/video/47734/%98%26sup1%3B%83%9E%83%82---just-fit.html', |
15 | 'md5': '0480f1ef3932d901f0e0e719f188f19b', | |
16 | 'info_dict': { | |
17 | 'id': '47734', | |
18 | 'ext': 'flv', | |
19 | 'title': '高樹マリア - Just fit', | |
20 | 'uploader': 'dj7970', | |
21 | 'uploader_id': 'dj7970' | |
466de688 | 22 | } |
584d6f34 | 23 | }, { |
a2e32866 | 24 | # html5 media |
584d6f34 YCH |
25 | 'url': 'http://www.thisav.com/video/242352/nerdy-18yo-big-ass-tattoos-and-glasses.html', |
26 | 'md5': 'ba90c076bd0f80203679e5b60bf523ee', | |
27 | 'info_dict': { | |
28 | 'id': '242352', | |
29 | 'ext': 'mp4', | |
30 | 'title': 'Nerdy 18yo Big Ass Tattoos and Glasses', | |
31 | 'uploader': 'cybersluts', | |
32 | 'uploader_id': 'cybersluts', | |
33 | }, | |
34 | }] | |
466de688 PH |
35 | |
36 | def _real_extract(self, url): | |
37 | mobj = re.match(self._VALID_URL, url) | |
38 | ||
39 | video_id = mobj.group('id') | |
40 | webpage = self._download_webpage(url, video_id) | |
d8dbf870 YCH |
41 | title = remove_end(self._html_search_regex( |
42 | r'<title>([^<]+)</title>', webpage, 'title'), | |
43 | ' - 視頻 - ThisAV.com-世界第一中文成人娛樂網站') | |
466de688 | 44 | video_url = self._html_search_regex( |
584d6f34 YCH |
45 | r"addVariable\('file','([^']+)'\);", webpage, 'video url', default=None) |
46 | if video_url: | |
47 | info_dict = { | |
48 | 'formats': [{ | |
49 | 'url': video_url, | |
50 | }], | |
51 | } | |
52 | else: | |
a2e32866 S |
53 | entries = self._parse_html5_media_entries(url, webpage, video_id) |
54 | if entries: | |
55 | info_dict = entries[0] | |
56 | else: | |
57 | info_dict = self._extract_jwplayer_data( | |
58 | webpage, video_id, require_title=False) | |
466de688 | 59 | uploader = self._html_search_regex( |
197224b7 | 60 | r': <a href="http://www\.thisav\.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>', |
fa7df757 | 61 | webpage, 'uploader name', fatal=False) |
466de688 | 62 | uploader_id = self._html_search_regex( |
197224b7 | 63 | r': <a href="http://www\.thisav\.com/user/[0-9]+/([^"]+)">(?:[^<]+)</a>', |
fa7df757 | 64 | webpage, 'uploader id', fatal=False) |
5f6a1245 | 65 | |
584d6f34 | 66 | info_dict.update({ |
8bcc8756 | 67 | 'id': video_id, |
8bcc8756 | 68 | 'uploader': uploader, |
466de688 | 69 | 'uploader_id': uploader_id, |
8bcc8756 | 70 | 'title': title, |
584d6f34 YCH |
71 | }) |
72 | ||
73 | return info_dict |