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.

57 lines
1.9 KiB

11 years ago
  1. from __future__ import unicode_literals
  2. from .youtube import YoutubeIE
  3. from .jwplatform import JWPlatformBaseIE
  4. class WimpIE(JWPlatformBaseIE):
  5. _VALID_URL = r'https?://(?:www\.)?wimp\.com/(?P<id>[^/]+)'
  6. _TESTS = [{
  7. 'url': 'http://www.wimp.com/maru-is-exhausted/',
  8. 'md5': 'ee21217ffd66d058e8b16be340b74883',
  9. 'info_dict': {
  10. 'id': 'maru-is-exhausted',
  11. 'ext': 'mp4',
  12. 'title': 'Maru is exhausted.',
  13. 'description': 'md5:57e099e857c0a4ea312542b684a869b8',
  14. }
  15. }, {
  16. 'url': 'http://www.wimp.com/clowncar/',
  17. 'md5': '5c31ad862a90dc5b1f023956faec13fe',
  18. 'info_dict': {
  19. 'id': 'cG4CEr2aiSg',
  20. 'ext': 'webm',
  21. 'title': 'Basset hound clown car...incredible!',
  22. 'description': '5 of my Bassets crawled in this dog loo! www.bellinghambassets.com\n\nFor licensing/usage please contact: licensing(at)jukinmediadotcom',
  23. 'upload_date': '20140303',
  24. 'uploader': 'Gretchen Hoey',
  25. 'uploader_id': 'gretchenandjeff1',
  26. },
  27. 'add_ie': ['Youtube'],
  28. }]
  29. def _real_extract(self, url):
  30. video_id = self._match_id(url)
  31. webpage = self._download_webpage(url, video_id)
  32. youtube_id = self._search_regex(
  33. r"videoId\s*:\s*[\"']([0-9A-Za-z_-]{11})[\"']",
  34. webpage, 'video URL', default=None)
  35. if youtube_id:
  36. return {
  37. '_type': 'url',
  38. 'url': youtube_id,
  39. 'ie_key': YoutubeIE.ie_key(),
  40. }
  41. info_dict = self._extract_jwplayer_data(
  42. webpage, video_id, require_title=False)
  43. info_dict.update({
  44. 'id': video_id,
  45. 'title': self._og_search_title(webpage),
  46. 'description': self._og_search_description(webpage),
  47. })
  48. return info_dict