Revert "Workaround for regex engine limitation"
[youtube-dl] / 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/maruexhausted/',
12         'md5': 'f1acced123ecb28d9bb79f2479f2b6a1',
13         'info_dict': {
14             'id': 'maruexhausted',
15             'ext': 'flv',
16             'title': 'Maru is exhausted.',
17             'description': 'md5:57e099e857c0a4ea312542b684a869b8',
18         }
19     }
20
21     def _real_extract(self, url):
22         mobj = re.match(self._VALID_URL, url)
23         video_id = mobj.group(1)
24         webpage = self._download_webpage(url, video_id)
25         video_url = self._search_regex(
26             r's1\.addVariable\("file",\s*"([^"]+)"\);', webpage, 'video URL')
27
28         return {
29             'id': video_id,
30             'url': video_url,
31             'title': self._og_search_title(webpage),
32             'thumbnail': self._og_search_thumbnail(webpage),
33             'description': self._og_search_description(webpage),
34         }