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.

34 lines
1.2 KiB

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