1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-05 10:39:01 +08:00
youtube-dl/youtube_dl/extractor/keek.py

47 lines
1.6 KiB
Python
Raw Normal View History

from __future__ import unicode_literals
2013-06-24 04:16:41 +08:00
from .common import InfoExtractor
class KeekIE(InfoExtractor):
2014-12-13 19:35:13 +08:00
_VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<id>\w+)'
IE_NAME = 'keek'
2013-06-28 02:46:46 +08:00
_TEST = {
'url': 'https://www.keek.com/ytdl/keeks/NODfbab',
2014-12-13 19:35:13 +08:00
'md5': '09c5c109067536c1cec8bac8c21fea05',
'info_dict': {
2014-12-13 19:35:13 +08:00
'id': 'NODfbab',
'ext': 'mp4',
'uploader': 'youtube-dl project',
'uploader_id': 'ytdl',
'title': 'test chars: "\'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
},
2013-06-28 02:46:46 +08:00
}
2013-06-24 04:16:41 +08:00
def _real_extract(self, url):
2014-12-13 19:35:13 +08:00
video_id = self._match_id(url)
2013-06-24 04:16:41 +08:00
video_url = 'http://cdn.keek.com/keek/video/%s' % video_id
thumbnail = 'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
2013-06-24 04:16:41 +08:00
webpage = self._download_webpage(url, video_id)
2014-12-13 19:35:13 +08:00
raw_desc = self._html_search_meta('description', webpage)
if raw_desc:
uploader = self._html_search_regex(
r'Watch (.*?)\s+\(', raw_desc, 'uploader', fatal=False)
uploader_id = self._html_search_regex(
r'Watch .*?\(@(.+?)\)', raw_desc, 'uploader_id', fatal=False)
else:
uploader = None
uploader_id = None
return {
'id': video_id,
'url': video_url,
'ext': 'mp4',
'title': self._og_search_title(webpage),
'thumbnail': thumbnail,
2014-12-13 19:35:13 +08:00
'uploader': uploader,
'uploader_id': uploader_id,
2013-06-24 04:16:41 +08:00
}