1 from __future__ import unicode_literals
5 from .common import InfoExtractor
11 class PlayvidIE(InfoExtractor):
13 _VALID_URL = r'^(?:https?://)?www\.playvid\.com/watch(\?v=|/)(?P<id>.+?)(#|$)'
15 'url': 'http://www.playvid.com/watch/agbDDi7WZTV',
16 'file': 'agbDDi7WZTV.mp4',
17 'md5': '44930f8afa616efdf9482daf4fe53e1e',
19 'title': 'Michelle Lewin in Miami Beach',
25 def _real_extract(self, url):
26 mobj = re.match(self._VALID_URL, url)
27 video_id = mobj.group('id')
29 webpage = self._download_webpage(url, video_id)
31 self.report_extraction(video_id)
35 video_thumbnail = None
38 # most of the information is stored in the flashvars
39 flashvars_match = re.search(r'flashvars="(.+?)"',webpage)
42 infos = compat_urllib_parse.unquote(flashvars_match.group(1)).split(r'&')
44 videovars_match = re.match(r'^video_vars\[(.+?)\]=(.+?)$',info)
46 key = videovars_match.group(1)
47 val = videovars_match.group(2)
50 video_title = val.replace('+',' ')
56 if key == 'big_thumb':
59 videourl_match = re.match(r'^video_urls\]\[(?P<resolution>\d+)p',key)
61 resolution = int(videourl_match.group('resolution'))
63 'resolution': resolution, # 360, 480, ...
64 'ext': determine_ext(val),
68 # fatal error, if no download url is found
70 raise ExtractorError,'no video url found'
72 # Extract title - should be in the flashvars; if not, look elsewhere
73 if video_title is None:
74 video_title = self._html_search_regex(
75 r'<title>(.*?)</title', webpage, 'title')
81 'thumbnail': video_thumbnail,