]>
Commit | Line | Data |
---|---|---|
2250865f PH |
1 | from __future__ import unicode_literals |
2 | ||
405ec05c | 3 | import re |
ed92bc9f | 4 | |
405ec05c | 5 | from .common import InfoExtractor |
983af260 | 6 | from .youtube import YoutubeIE |
405ec05c YK |
7 | |
8 | ||
9 | class WimpIE(InfoExtractor): | |
da362979 | 10 | _VALID_URL = r'http://(?:www\.)?wimp\.com/([^/]+)/' |
983af260 | 11 | _TESTS = [{ |
da362979 S |
12 | 'url': 'http://www.wimp.com/maruexhausted/', |
13 | 'md5': 'f1acced123ecb28d9bb79f2479f2b6a1', | |
2250865f | 14 | 'info_dict': { |
da362979 S |
15 | 'id': 'maruexhausted', |
16 | 'ext': 'flv', | |
17 | 'title': 'Maru is exhausted.', | |
18 | 'description': 'md5:57e099e857c0a4ea312542b684a869b8', | |
6f5ac90c | 19 | } |
983af260 JMF |
20 | }, { |
21 | # youtube video | |
22 | 'url': 'http://www.wimp.com/clowncar/', | |
23 | 'info_dict': { | |
24 | 'id': 'cG4CEr2aiSg', | |
25 | 'ext': 'mp4', | |
26 | 'title': 'Basset hound clown car...incredible!', | |
27 | 'description': 'md5:8d228485e0719898c017203f900b3a35', | |
28 | 'uploader': 'Gretchen Hoey', | |
29 | 'uploader_id': 'gretchenandjeff1', | |
30 | 'upload_date': '20140303', | |
31 | }, | |
32 | 'add_ie': ['Youtube'], | |
33 | }] | |
405ec05c YK |
34 | |
35 | def _real_extract(self, url): | |
36 | mobj = re.match(self._VALID_URL, url) | |
37 | video_id = mobj.group(1) | |
38 | webpage = self._download_webpage(url, video_id) | |
2250865f | 39 | video_url = self._search_regex( |
e7642ab5 | 40 | r"[\"']file[\"']\s*[:,]\s*[\"'](.+?)[\"']", webpage, 'video URL') |
983af260 JMF |
41 | if YoutubeIE.suitable(video_url): |
42 | self.to_screen('Found YouTube video') | |
43 | return { | |
44 | '_type': 'url', | |
45 | 'url': video_url, | |
46 | 'ie_key': YoutubeIE.ie_key(), | |
47 | } | |
5abeaf06 | 48 | |
11bf8481 PH |
49 | return { |
50 | 'id': video_id, | |
2250865f | 51 | 'url': video_url, |
11bf8481 PH |
52 | 'title': self._og_search_title(webpage), |
53 | 'thumbnail': self._og_search_thumbnail(webpage), | |
54 | 'description': self._og_search_description(webpage), | |
983af260 | 55 | } |