ytdl-nightly/youtube_dl/extractor/keek.py

43 lines
1.5 KiB
Python
Raw Normal View History

from __future__ import unicode_literals
2015-09-26 19:04:25 +02:00
import re
2013-06-23 22:16:41 +02:00
from .common import InfoExtractor
class KeekIE(InfoExtractor):
2015-09-24 23:38:00 +02:00
_VALID_URL = r'https?://(?:www\.)?keek\.com/keek/(?P<id>\w+)'
IE_NAME = 'keek'
2013-06-27 20:46:46 +02:00
_TEST = {
2015-09-24 23:38:00 +02:00
'url': 'https://www.keek.com/keek/NODfbab',
'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
'info_dict': {
2014-12-13 12:35:13 +01:00
'id': 'NODfbab',
'ext': 'mp4',
2015-09-24 23:38:00 +02:00
'title': 'test chars: "\'/\\ä<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de . - Video - Videos on Keek',
2015-09-26 19:04:25 +02:00
'description': 'test chars: "\'/\\ä<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
'uploader': 'ytdl',
'uploader_id': 'eGT5bab',
},
2013-06-27 20:46:46 +02:00
}
2013-06-23 22:16:41 +02:00
def _real_extract(self, url):
2014-12-13 12:35:13 +01:00
video_id = self._match_id(url)
2013-06-23 22:16:41 +02:00
webpage = self._download_webpage(url, video_id)
2015-09-26 19:04:25 +02:00
uploader = uploader_id = None
matches = re.search(r'data-username="(?P<uploader>[^"]+)"[^>]*data-user-id="(?P<uploader_id>[^"]+)"', webpage)
if matches:
uploader, uploader_id = matches.groups()
2013-06-23 22:16:41 +02:00
return {
'id': video_id,
2015-09-24 23:38:00 +02:00
'url': self._og_search_video_url(webpage),
'ext': 'mp4',
'title': self._og_search_title(webpage),
2015-09-26 19:04:25 +02:00
'description': self._og_search_description(webpage),
2015-09-24 23:38:00 +02:00
'thumbnail': self._og_search_thumbnail(webpage),
2015-09-26 19:04:25 +02:00
'uploader': uploader,
'uploader_id': uploader_id,
2013-06-23 22:16:41 +02:00
}