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.

28 lines
1.0 KiB

  1. import re
  2. import base64
  3. from .common import InfoExtractor
  4. class WimpIE(InfoExtractor):
  5. _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
  6. def _real_extract(self, url):
  7. mobj = re.match(self._VALID_URL, url)
  8. video_id = mobj.group(1)
  9. webpage = self._download_webpage(url, video_id)
  10. title = self._search_regex(r'<meta name="description" content="(.+?)" />',webpage, 'video title')
  11. thumbnail_url = self._search_regex(r'<meta property="og\:image" content="(.+?)" />', webpage,'video thumbnail')
  12. googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url')
  13. googleString = base64.b64decode(googleString).decode('ascii')
  14. final_url = self._search_regex('","(.*?)"', googleString,'final video url')
  15. ext = final_url.rpartition(u'.')[2]
  16. return [{
  17. 'id': video_id,
  18. 'url': final_url,
  19. 'ext': ext,
  20. 'title': title,
  21. 'thumbnail': thumbnail_url,
  22. }]