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.

39 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class FunnyOrDieIE(InfoExtractor):
  5. _VALID_URL = r'^(?:https?://)?(?:www\.)?funnyordie\.com/videos/(?P<id>[0-9a-f]+)/.*$'
  6. _TEST = {
  7. 'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
  8. 'file': '0732f586d7.mp4',
  9. 'md5': 'f647e9e90064b53b6e046e75d0241fbd',
  10. 'info_dict': {
  11. 'description': ('Lyrics changed to match the video. Spoken cameo '
  12. 'by Obscurus Lupa (from ThatGuyWithTheGlasses.com). Based on a '
  13. 'concept by Dustin McLean (DustFilms.com). Performed, edited, '
  14. 'and written by David A. Scott.'),
  15. 'title': 'Heart-Shaped Box: Literal Video Version',
  16. },
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. webpage = self._download_webpage(url, video_id)
  22. video_url = self._search_regex(
  23. [r'type="video/mp4" src="(.*?)"', r'src="([^>]*?)" type=\'video/mp4\''],
  24. webpage, 'video URL', flags=re.DOTALL)
  25. return {
  26. 'id': video_id,
  27. 'url': video_url,
  28. 'ext': 'mp4',
  29. 'title': self._og_search_title(webpage),
  30. 'description': self._og_search_description(webpage),
  31. }