1 from __future__ import unicode_literals
5 from .common import InfoExtractor
13 class PlayvidIE(InfoExtractor):
14 _VALID_URL = r'^https?://www\.playvid\.com/watch(\?v=|/)(?P<id>.+?)(?:#|$)'
16 'url': 'http://www.playvid.com/watch/agbDDi7WZTV',
17 'md5': '44930f8afa616efdf9482daf4fe53e1e',
21 'title': 'Michelle Lewin in Miami Beach',
27 def _real_extract(self, url):
28 mobj = re.match(self._VALID_URL, url)
29 video_id = mobj.group('id')
31 webpage = self._download_webpage(url, video_id)
34 r'<div class="block-error">\s*<div class="heading">\s*<div>(?P<msg>.+?)</div>\s*</div>', webpage)
36 raise ExtractorError(clean_html(m_error.group('msg')), expected=True)
40 video_thumbnail = None
43 # most of the information is stored in the flashvars
44 flashvars = self._html_search_regex(
45 r'flashvars="(.+?)"', webpage, 'flashvars')
47 infos = compat_urllib_parse.unquote(flashvars).split(r'&')
49 videovars_match = re.match(r'^video_vars\[(.+?)\]=(.+?)$', info)
51 key = videovars_match.group(1)
52 val = videovars_match.group(2)
55 video_title = compat_urllib_parse.unquote_plus(val)
61 if key == 'big_thumb':
64 videourl_match = re.match(
65 r'^video_urls\]\[(?P<resolution>[0-9]+)p', key)
67 height = int(videourl_match.group('resolution'))
72 self._sort_formats(formats)
74 # Extract title - should be in the flashvars; if not, look elsewhere
75 if video_title is None:
76 video_title = self._html_search_regex(
77 r'<title>(.*?)</title', webpage, 'title')
83 'thumbnail': video_thumbnail,