]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/wimp.py
Merge branch 'atomicdryad-pr-bbcnews'
[yt-dlp.git] / youtube_dl / extractor / wimp.py
CommitLineData
2250865f
PH
1from __future__ import unicode_literals
2
405ec05c 3import re
ed92bc9f 4
405ec05c 5from .common import InfoExtractor
983af260 6from .youtube import YoutubeIE
405ec05c
YK
7
8
9class 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(
4f514c7e
S
40 [r"[\"']file[\"']\s*[:,]\s*[\"'](.+?)[\"']", r"videoId\s*:\s*[\"']([^\"']+)[\"']"],
41 webpage, 'video URL')
983af260
JMF
42 if YoutubeIE.suitable(video_url):
43 self.to_screen('Found YouTube video')
44 return {
45 '_type': 'url',
46 'url': video_url,
47 'ie_key': YoutubeIE.ie_key(),
48 }
5abeaf06 49
11bf8481
PH
50 return {
51 'id': video_id,
2250865f 52 'url': video_url,
11bf8481
PH
53 'title': self._og_search_title(webpage),
54 'thumbnail': self._og_search_thumbnail(webpage),
55 'description': self._og_search_description(webpage),
983af260 56 }