]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wimp.py
9a6bb0c768a046e96bac0aa3dd39875821119e83
[youtubedl] / youtube_dl / extractor / wimp.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class WimpIE(InfoExtractor):
9 _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
10 _TEST = {
11 'url': 'http://www.wimp.com/deerfence/',
12 'file': 'deerfence.flv',
13 'md5': '8b215e2e0168c6081a1cf84b2846a2b5',
14 'info_dict': {
15 "title": "Watch Till End: Herd of deer jump over a fence.",
16 "description": "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.",
17 }
18 }
19
20 def _real_extract(self, url):
21 mobj = re.match(self._VALID_URL, url)
22 video_id = mobj.group(1)
23 webpage = self._download_webpage(url, video_id)
24 video_url = self._search_regex(
25 r's1\.addVariable\("file",\s*"([^"]+)"\);', webpage, 'video URL')
26
27 return {
28 'id': video_id,
29 'url': video_url,
30 'title': self._og_search_title(webpage),
31 'thumbnail': self._og_search_thumbnail(webpage),
32 'description': self._og_search_description(webpage),
33 }