]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/keek.py
[README.md] Make download URLs consistent
[youtube-dl] / youtube_dl / extractor / keek.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class KeekIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?keek\.com/keek/(?P<id>\w+)'
9     IE_NAME = 'keek'
10     _TEST = {
11         'url': 'https://www.keek.com/keek/NODfbab',
12         'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
13         'info_dict': {
14             'id': 'NODfbab',
15             'ext': 'mp4',
16             'title': 'md5:35d42050a3ece241d5ddd7fdcc6fd896',
17             'uploader': 'ytdl',
18             'uploader_id': 'eGT5bab',
19         },
20     }
21
22     def _real_extract(self, url):
23         video_id = self._match_id(url)
24
25         webpage = self._download_webpage(url, video_id)
26
27         return {
28             'id': video_id,
29             'url': self._og_search_video_url(webpage),
30             'ext': 'mp4',
31             'title': self._og_search_description(webpage).strip(),
32             'thumbnail': self._og_search_thumbnail(webpage),
33             'uploader': self._search_regex(
34                 r'data-username=(["\'])(?P<uploader>.+?)\1', webpage,
35                 'uploader', fatal=False, group='uploader'),
36             'uploader_id': self._search_regex(
37                 r'data-user-id=(["\'])(?P<uploader_id>.+?)\1', webpage,
38                 'uploader id', fatal=False, group='uploader_id'),
39         }