You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class KeekIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<id>\w+)'
  5. IE_NAME = 'keek'
  6. _TEST = {
  7. 'url': 'https://www.keek.com/ytdl/keeks/NODfbab',
  8. 'md5': '09c5c109067536c1cec8bac8c21fea05',
  9. 'info_dict': {
  10. 'id': 'NODfbab',
  11. 'ext': 'mp4',
  12. 'uploader': 'youtube-dl project',
  13. 'uploader_id': 'ytdl',
  14. 'title': 'test chars: "\'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. video_url = 'http://cdn.keek.com/keek/video/%s' % video_id
  20. thumbnail = 'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
  21. webpage = self._download_webpage(url, video_id)
  22. raw_desc = self._html_search_meta('description', webpage)
  23. if raw_desc:
  24. uploader = self._html_search_regex(
  25. r'Watch (.*?)\s+\(', raw_desc, 'uploader', fatal=False)
  26. uploader_id = self._html_search_regex(
  27. r'Watch .*?\(@(.+?)\)', raw_desc, 'uploader_id', fatal=False)
  28. else:
  29. uploader = None
  30. uploader_id = None
  31. return {
  32. 'id': video_id,
  33. 'url': video_url,
  34. 'ext': 'mp4',
  35. 'title': self._og_search_title(webpage),
  36. 'thumbnail': thumbnail,
  37. 'uploader': uploader,
  38. 'uploader_id': uploader_id,
  39. }