[subtitles] Added tests to check correct behavior when no subtitles are
[youtube-dl] / 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     _TEST = {
10         u'url': u'http://www.keek.com/ytdl/keeks/NODfbab',
11         u'file': u'NODfbab.mp4',
12         u'md5': u'9b0636f8c0f7614afa4ea5e4c6e57e83',
13         u'info_dict': {
14             u"uploader": u"ytdl", 
15             u"title": u"test chars: \"'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de ."
16         }
17     }
18
19     def _real_extract(self, url):
20         m = re.match(self._VALID_URL, url)
21         video_id = m.group('videoID')
22
23         video_url = u'http://cdn.keek.com/keek/video/%s' % video_id
24         thumbnail = u'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
25         webpage = self._download_webpage(url, video_id)
26
27         video_title = self._og_search_title(webpage)
28
29         uploader = self._html_search_regex(r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
30             webpage, u'uploader', fatal=False)
31
32         info = {
33                 'id': video_id,
34                 'url': video_url,
35                 'ext': 'mp4',
36                 'title': video_title,
37                 'thumbnail': thumbnail,
38                 'uploader': uploader
39         }
40         return [info]