1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
7 compat_urllib_parse_unquote
,
8 compat_urllib_parse_unquote_plus
,
16 class PlayvidIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://www\.playvid\.com/watch(\?v=|/)(?P<id>.+?)(?:#|$)'
19 'url': 'http://www.playvid.com/watch/RnmBNgtrrJu',
20 'md5': 'ffa2f6b2119af359f544388d8c01eb6c',
24 'title': 'md5:9256d01c6317e3f703848b5906880dc8',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, video_id
)
35 r
'<div class="block-error">\s*<div class="heading">\s*<div>(?P<msg>.+?)</div>\s*</div>', webpage
)
37 raise ExtractorError(clean_html(m_error
.group('msg')), expected
=True)
41 video_thumbnail
= None
44 # most of the information is stored in the flashvars
45 flashvars
= self
._html
_search
_regex
(
46 r
'flashvars="(.+?)"', webpage
, 'flashvars')
48 infos
= compat_urllib_parse_unquote(flashvars
).split(r
'&')
50 videovars_match
= re
.match(r
'^video_vars\[(.+?)\]=(.+?)$', info
)
52 key
= videovars_match
.group(1)
53 val
= videovars_match
.group(2)
56 video_title
= compat_urllib_parse_unquote_plus(val
)
62 if key
== 'big_thumb':
65 videourl_match
= re
.match(
66 r
'^video_urls\]\[(?P<resolution>[0-9]+)p', key
)
68 height
= int(videourl_match
.group('resolution'))
73 self
._sort
_formats
(formats
)
75 # Extract title - should be in the flashvars; if not, look elsewhere
76 if video_title
is None:
77 video_title
= self
._html
_search
_regex
(
78 r
'<title>(.*?)</title', webpage
, 'title')
84 'thumbnail': video_thumbnail
,