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.

48 lines
1.6 KiB

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