]>
Commit | Line | Data |
---|---|---|
3798eadc PH |
1 | from __future__ import unicode_literals |
2 | ||
62008f69 | 3 | import re |
62008f69 AK |
4 | |
5 | from .common import InfoExtractor | |
e4decf27 AK |
6 | from ..utils import ( |
7 | compat_urllib_parse, | |
9906d397 PH |
8 | determine_ext, |
9 | ExtractorError, | |
e4decf27 | 10 | ) |
62008f69 | 11 | |
3798eadc | 12 | |
d798e1c7 | 13 | class AUEngineIE(InfoExtractor): |
b4461b6e S |
14 | _VALID_URL = r'http://(?:www\.)?auengine\.com/embed\.php\?.*?file=(?P<id>[^&]+).*?' |
15 | ||
5d2eac9e | 16 | _TEST = { |
3798eadc | 17 | 'url': 'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370', |
3798eadc PH |
18 | 'md5': '48972bdbcf1a3a2f5533e62425b41d4f', |
19 | 'info_dict': { | |
b4461b6e S |
20 | 'id': 'lfvlytY6', |
21 | 'ext': 'mp4', | |
3798eadc | 22 | 'title': '[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]' |
5d2eac9e PH |
23 | } |
24 | } | |
62008f69 AK |
25 | |
26 | def _real_extract(self, url): | |
27 | mobj = re.match(self._VALID_URL, url) | |
b4461b6e S |
28 | video_id = mobj.group('id') |
29 | ||
62008f69 | 30 | webpage = self._download_webpage(url, video_id) |
b4461b6e | 31 | title = self._html_search_regex(r'<title>(?P<title>.+?)</title>', webpage, 'title') |
62008f69 | 32 | title = title.strip() |
9906d397 PH |
33 | links = re.findall(r'\s(?:file|url):\s*["\']([^\'"]+)["\']', webpage) |
34 | links = map(compat_urllib_parse.unquote, links) | |
35 | ||
36 | thumbnail = None | |
37 | video_url = None | |
62008f69 | 38 | for link in links: |
9906d397 | 39 | if link.endswith('.png'): |
62008f69 | 40 | thumbnail = link |
9906d397 PH |
41 | elif '/videos/' in link: |
42 | video_url = link | |
43 | if not video_url: | |
b4461b6e | 44 | raise ExtractorError('Could not find video URL') |
3798eadc | 45 | ext = '.' + determine_ext(video_url) |
62008f69 AK |
46 | if ext == title[-len(ext):]: |
47 | title = title[:-len(ext)] | |
9906d397 PH |
48 | |
49 | return { | |
b4461b6e S |
50 | 'id': video_id, |
51 | 'url': video_url, | |
52 | 'title': title, | |
62008f69 | 53 | 'thumbnail': thumbnail, |
a59e40a1 | 54 | 'http_referer': 'http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf', |
9906d397 | 55 | } |