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.

41 lines
1.4 KiB

  1. import re
  2. from .common import InfoExtractor
  3. class KeekIE(InfoExtractor):
  4. _VALID_URL = r'http://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
  5. IE_NAME = u'keek'
  6. _TEST = {
  7. u'url': u'http://www.keek.com/ytdl/keeks/NODfbab',
  8. u'file': u'NODfbab.mp4',
  9. u'md5': u'9b0636f8c0f7614afa4ea5e4c6e57e83',
  10. u'info_dict': {
  11. u"uploader": u"ytdl",
  12. u"title": u"test chars: \"'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de ."
  13. }
  14. }
  15. def _real_extract(self, url):
  16. m = re.match(self._VALID_URL, url)
  17. video_id = m.group('videoID')
  18. video_url = u'http://cdn.keek.com/keek/video/%s' % video_id
  19. thumbnail = u'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
  20. webpage = self._download_webpage(url, video_id)
  21. video_title = self._html_search_regex(r'<meta property="og:title" content="(?P<title>.*?)"',
  22. webpage, u'title')
  23. uploader = self._html_search_regex(r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
  24. webpage, u'uploader', fatal=False)
  25. info = {
  26. 'id': video_id,
  27. 'url': video_url,
  28. 'ext': 'mp4',
  29. 'title': video_title,
  30. 'thumbnail': thumbnail,
  31. 'uploader': uploader
  32. }
  33. return [info]