]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/wimp.py
Merge remote-tracking branch 'rzhxeo/crunchyroll'
[yt-dlp.git] / youtube_dl / extractor / wimp.py
CommitLineData
405ec05c
YK
1import re
2import base64
ed92bc9f 3
405ec05c
YK
4from .common import InfoExtractor
5
6
7class 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': {
11bf8481
PH
14 u"title": u"Watch Till End: Herd of deer jump over a fence.",
15 u"description": u"These deer look as fluid as running water when they jump over this fence as a herd. This video is one that needs to be watched until the very end for the true majesty to be witnessed, but once it comes, it's sure to take your breath away.",
6f5ac90c
PH
16 }
17 }
405ec05c
YK
18
19 def _real_extract(self, url):
20 mobj = re.match(self._VALID_URL, url)
21 video_id = mobj.group(1)
22 webpage = self._download_webpage(url, video_id)
ed92bc9f 23 googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url')
b1dfdc51 24 googleString = base64.b64decode(googleString).decode('ascii')
2101830c 25 final_url = self._search_regex('","(.*?)"', googleString, u'final video url')
5abeaf06 26
11bf8481
PH
27 return {
28 'id': video_id,
29 'url': final_url,
30 'title': self._og_search_title(webpage),
31 'thumbnail': self._og_search_thumbnail(webpage),
32 'description': self._og_search_description(webpage),
33 }