]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/keek.py
d84774dca27e4da0322bc591d1c691aabae72669
[youtube-dl] / youtube_dl / extractor / keek.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class KeekIE(InfoExtractor):
10     _VALID_URL = r'https?://(?:www\.)?keek\.com/keek/(?P<id>\w+)'
11     IE_NAME = 'keek'
12     _TEST = {
13         'url': 'https://www.keek.com/keek/NODfbab',
14         'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
15         'info_dict': {
16             'id': 'NODfbab',
17             'ext': 'mp4',
18             'title': 'test chars: "\'/\\รค<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de . - Video - Videos on Keek',
19             'description': 'md5:35d42050a3ece241d5ddd7fdcc6fd896',
20             'uploader': 'ytdl',
21             'uploader_id': 'eGT5bab',
22         },
23     }
24
25     def _real_extract(self, url):
26         video_id = self._match_id(url)
27
28         webpage = self._download_webpage(url, video_id)
29         uploader = uploader_id = None
30         matches = re.search(r'data-username="(?P<uploader>[^"]+)"[^>]*data-user-id="(?P<uploader_id>[^"]+)"', webpage)
31         if matches:
32             uploader, uploader_id = matches.groups()
33
34         return {
35             'id': video_id,
36             'url': self._og_search_video_url(webpage),
37             'ext': 'mp4',
38             'title': self._og_search_title(webpage),
39             'description': self._og_search_description(webpage),
40             'thumbnail': self._og_search_thumbnail(webpage),
41             'uploader': uploader,
42             'uploader_id': uploader_id,
43         }