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.

40 lines
1.3 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<videoID>\w+)'
  6. IE_NAME = 'keek'
  7. _TEST = {
  8. 'url': 'https://www.keek.com/ytdl/keeks/NODfbab',
  9. 'file': 'NODfbab.mp4',
  10. 'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
  11. 'info_dict': {
  12. 'uploader': 'ytdl',
  13. 'title': 'test chars: "\'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
  14. },
  15. }
  16. def _real_extract(self, url):
  17. m = re.match(self._VALID_URL, url)
  18. video_id = m.group('videoID')
  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. uploader = self._html_search_regex(
  23. r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
  24. webpage, 'uploader', fatal=False)
  25. return {
  26. 'id': video_id,
  27. 'url': video_url,
  28. 'ext': 'mp4',
  29. 'title': self._og_search_title(webpage),
  30. 'thumbnail': thumbnail,
  31. 'uploader': uploader
  32. }