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.

35 lines
1.3 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(
  19. [r'type="video/mp4" src="(.*?)"', r'src="([^>]*?)" type=\'video/mp4\''],
  20. webpage, u'video URL', flags=re.DOTALL)
  21. info = {
  22. 'id': video_id,
  23. 'url': video_url,
  24. 'ext': 'mp4',
  25. 'title': self._og_search_title(webpage),
  26. 'description': self._og_search_description(webpage),
  27. }
  28. return [info]