]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/playvid.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  11 class PlayvidIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'^https?://www\.playvid\.com/watch(\?v=|/)(?P<id>.+?)(?:#|$)' 
  14         'url': 'http://www.playvid.com/watch/agbDDi7WZTV', 
  15         '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
) 
  33         video_thumbnail 
= None 
  36         # most of the information is stored in the flashvars 
  37         flashvars 
= self
._html
_search
_regex
( 
  38             r
'flashvars="(.+?)"', webpage
, 'flashvars') 
  40         infos 
= compat_urllib_parse
.unquote(flashvars
).split(r
'&') 
  42             videovars_match 
= re
.match(r
'^video_vars\[(.+?)\]=(.+?)$', info
) 
  44                 key 
= videovars_match
.group(1) 
  45                 val 
= videovars_match
.group(2) 
  48                     video_title 
= compat_urllib_parse
.unquote_plus(val
) 
  54                 if key 
== 'big_thumb': 
  57                 videourl_match 
= re
.match( 
  58                     r
'^video_urls\]\[(?P<resolution>[0-9]+)p', key
) 
  60                     height 
= int(videourl_match
.group('resolution')) 
  65         self
._sort
_formats
(formats
) 
  67         # Extract title - should be in the flashvars; if not, look elsewhere 
  68         if video_title 
is None: 
  69             video_title 
= self
._html
_search
_regex
( 
  70                 r
'<title>(.*?)</title', webpage
, 'title') 
  76             'thumbnail': video_thumbnail
,