]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/keek.py
Imported Upstream version 2014.08.05
[youtubedl] / youtube_dl / extractor / keek.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class KeekIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
10 IE_NAME = 'keek'
11 _TEST = {
12 'url': 'https://www.keek.com/ytdl/keeks/NODfbab',
13 'file': 'NODfbab.mp4',
14 'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
15 'info_dict': {
16 'uploader': 'ytdl',
17 'title': 'test chars: "\'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
18 },
19 }
20
21 def _real_extract(self, url):
22 m = re.match(self._VALID_URL, url)
23 video_id = m.group('videoID')
24
25 video_url = 'http://cdn.keek.com/keek/video/%s' % video_id
26 thumbnail = 'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
27 webpage = self._download_webpage(url, video_id)
28
29 uploader = self._html_search_regex(
30 r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
31 webpage, 'uploader', fatal=False)
32
33 return {
34 'id': video_id,
35 'url': video_url,
36 'ext': 'mp4',
37 'title': self._og_search_title(webpage),
38 'thumbnail': thumbnail,
39 'uploader': uploader
40 }