]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/keek.py
e2093a0be92dd700002a20c00dd93f6e525e6da1
[youtubedl] / youtube_dl / extractor / keek.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class KeekIE(InfoExtractor):
7 _VALID_URL = r'http://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
8 IE_NAME = u'keek'
9
10 def _real_extract(self, url):
11 m = re.match(self._VALID_URL, url)
12 video_id = m.group('videoID')
13
14 video_url = u'http://cdn.keek.com/keek/video/%s' % video_id
15 thumbnail = u'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
16 webpage = self._download_webpage(url, video_id)
17
18 video_title = self._html_search_regex(r'<meta property="og:title" content="(?P<title>.*?)"',
19 webpage, u'title')
20
21 uploader = self._html_search_regex(r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
22 webpage, u'uploader', fatal=False)
23
24 info = {
25 'id': video_id,
26 'url': video_url,
27 'ext': 'mp4',
28 'title': video_title,
29 'thumbnail': thumbnail,
30 'uploader': uploader
31 }
32 return [info]