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.

54 lines
1.8 KiB

11 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from .youtube import YoutubeIE
  4. class WimpIE(InfoExtractor):
  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. r'data-id=["\']([0-9A-Za-z_-]{11})'),
  35. webpage, 'video URL', default=None)
  36. if youtube_id:
  37. return self.url_result(youtube_id, YoutubeIE.ie_key())
  38. info_dict = self._extract_jwplayer_data(
  39. webpage, video_id, require_title=False)
  40. info_dict.update({
  41. 'id': video_id,
  42. 'title': self._og_search_title(webpage),
  43. 'description': self._og_search_description(webpage),
  44. })
  45. return info_dict