]>
Commit | Line | Data |
---|---|---|
2250865f PH |
1 | from __future__ import unicode_literals |
2 | ||
405ec05c | 3 | from .common import InfoExtractor |
983af260 | 4 | from .youtube import YoutubeIE |
405ec05c YK |
5 | |
6 | ||
7 | class WimpIE(InfoExtractor): | |
0d2d967c | 8 | _VALID_URL = r'http://(?:www\.)?wimp\.com/(?P<id>[^/]+)' |
983af260 | 9 | _TESTS = [{ |
da362979 | 10 | 'url': 'http://www.wimp.com/maruexhausted/', |
b1b7d1ff | 11 | 'md5': 'ee21217ffd66d058e8b16be340b74883', |
2250865f | 12 | 'info_dict': { |
da362979 | 13 | 'id': 'maruexhausted', |
b1b7d1ff | 14 | 'ext': 'mp4', |
da362979 S |
15 | 'title': 'Maru is exhausted.', |
16 | 'description': 'md5:57e099e857c0a4ea312542b684a869b8', | |
6f5ac90c | 17 | } |
983af260 | 18 | }, { |
983af260 | 19 | 'url': 'http://www.wimp.com/clowncar/', |
b1b7d1ff | 20 | 'md5': '4e2986c793694b55b37cf92521d12bb4', |
983af260 | 21 | 'info_dict': { |
b1b7d1ff | 22 | 'id': 'clowncar', |
983af260 | 23 | 'ext': 'mp4', |
b1b7d1ff | 24 | 'title': 'It\'s like a clown car.', |
25 | 'description': 'md5:0e56db1370a6e49c5c1d19124c0d2fb2', | |
983af260 | 26 | }, |
983af260 | 27 | }] |
405ec05c YK |
28 | |
29 | def _real_extract(self, url): | |
b1b7d1ff | 30 | video_id = self._match_id(url) |
0d2d967c | 31 | |
405ec05c | 32 | webpage = self._download_webpage(url, video_id) |
0d2d967c S |
33 | |
34 | youtube_id = self._search_regex( | |
35 | r"videoId\s*:\s*[\"']([0-9A-Za-z_-]{11})[\"']", | |
36 | webpage, 'video URL', default=None) | |
37 | if youtube_id: | |
983af260 JMF |
38 | return { |
39 | '_type': 'url', | |
0d2d967c | 40 | 'url': youtube_id, |
983af260 JMF |
41 | 'ie_key': YoutubeIE.ie_key(), |
42 | } | |
5abeaf06 | 43 | |
0d2d967c | 44 | video_url = self._search_regex( |
17756125 | 45 | r'<video[^>]+>\s*<source[^>]+src=(["\'])(?P<url>.+?)\1', |
0d2d967c S |
46 | webpage, 'video URL', group='url') |
47 | ||
11bf8481 PH |
48 | return { |
49 | 'id': video_id, | |
2250865f | 50 | 'url': video_url, |
11bf8481 PH |
51 | 'title': self._og_search_title(webpage), |
52 | 'thumbnail': self._og_search_thumbnail(webpage), | |
53 | 'description': self._og_search_description(webpage), | |
983af260 | 54 | } |