]>
Commit | Line | Data |
---|---|---|
405ec05c YK |
1 | import re |
2 | import base64 | |
ed92bc9f | 3 | |
405ec05c YK |
4 | from .common import InfoExtractor |
5 | ||
6 | ||
7 | class WimpIE(InfoExtractor): | |
8 | _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/' | |
6f5ac90c PH |
9 | _TEST = { |
10 | u'url': u'http://www.wimp.com/deerfence/', | |
11 | u'file': u'deerfence.flv', | |
12 | u'md5': u'8b215e2e0168c6081a1cf84b2846a2b5', | |
13 | u'info_dict': { | |
14 | u"title": u"Watch Till End: Herd of deer jump over a fence." | |
15 | } | |
16 | } | |
405ec05c YK |
17 | |
18 | def _real_extract(self, url): | |
19 | mobj = re.match(self._VALID_URL, url) | |
20 | video_id = mobj.group(1) | |
21 | webpage = self._download_webpage(url, video_id) | |
ed92bc9f PH |
22 | title = self._search_regex(r'<meta name="description" content="(.+?)" />',webpage, 'video title') |
23 | thumbnail_url = self._search_regex(r'<meta property="og\:image" content="(.+?)" />', webpage,'video thumbnail') | |
24 | googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url') | |
b1dfdc51 YK |
25 | googleString = base64.b64decode(googleString).decode('ascii') |
26 | final_url = self._search_regex('","(.*?)"', googleString,'final video url') | |
ed92bc9f PH |
27 | ext = final_url.rpartition(u'.')[2] |
28 | ||
405ec05c YK |
29 | return [{ |
30 | 'id': video_id, | |
31 | 'url': final_url, | |
32 | 'ext': ext, | |
33 | 'title': title, | |
34 | 'thumbnail': thumbnail_url, | |
35 | }] | |
5abeaf06 | 36 |