1 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class FunnyOrDieIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])'
12 'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
13 'file': '0732f586d7.mp4',
14 'md5': 'f647e9e90064b53b6e046e75d0241fbd',
16 'description': ('Lyrics changed to match the video. Spoken cameo '
17 'by Obscurus Lupa (from ThatGuyWithTheGlasses.com). Based on a '
18 'concept by Dustin McLean (DustFilms.com). Performed, edited, '
19 'and written by David A. Scott.'),
20 'title': 'Heart-Shaped Box: Literal Video Version',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
27 video_id = mobj.group('id')
28 webpage = self._download_webpage(url, video_id)
30 video_url = self._search_regex(
31 [r'type="video/mp4" src="(.*?)"', r'src="([^>]*?)" type=\'video/mp4\''],
32 webpage, 'video URL', flags=re.DOTALL)
34 if mobj.group('type') == 'embed':
35 post_json = self._search_regex(
36 r'fb_post\s*=\s*(\{.*?\});', webpage, 'post details')
37 post = json.loads(post_json)
39 description = post.get('description')
40 thumbnail = post.get('picture')
42 title = self._og_search_title(webpage)
43 description = self._og_search_description(webpage)
51 'description': description,
52 'thumbnail': thumbnail,