]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wimp.py
Imported Upstream version 2013.06.34
[youtubedl] / youtube_dl / extractor / wimp.py
1 import re
2 import base64
3
4 from .common import InfoExtractor
5
6
7 class WimpIE(InfoExtractor):
8 _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
9
10 def _real_extract(self, url):
11 mobj = re.match(self._VALID_URL, url)
12 video_id = mobj.group(1)
13 webpage = self._download_webpage(url, video_id)
14 title = self._search_regex(r'<meta name="description" content="(.+?)" />',webpage, 'video title')
15 thumbnail_url = self._search_regex(r'<meta property="og\:image" content="(.+?)" />', webpage,'video thumbnail')
16 googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url')
17 googleString = base64.b64decode(googleString).decode('ascii')
18 final_url = self._search_regex('","(.*?)"', googleString,'final video url')
19 ext = final_url.rpartition(u'.')[2]
20
21 return [{
22 'id': video_id,
23 'url': final_url,
24 'ext': ext,
25 'title': title,
26 'thumbnail': thumbnail_url,
27 }]
28