]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vine.py
   3 from .common 
import InfoExtractor
 
   6 class VineIE(InfoExtractor
): 
   7     _VALID_URL 
= r
'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)' 
   9     def _real_extract(self
, url
): 
  10         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  12         video_id 
= mobj
.group('id') 
  13         webpage_url 
= 'https://vine.co/v/' + video_id
 
  14         webpage 
= self
._download
_webpage
(webpage_url
, video_id
) 
  16         self
.report_extraction(video_id
) 
  18         video_url 
= self
._html
_search
_regex
(r
'<meta property="twitter:player:stream" content="(.+?)"', 
  19             webpage
, u
'video URL') 
  21         video_title 
= self
._html
_search
_regex
(r
'<meta property="og:title" content="(.+?)"', 
  24         thumbnail 
= self
._html
_search
_regex
(r
'<meta property="og:image" content="(.+?)(\?.*?)?"', 
  25             webpage
, u
'thumbnail', fatal
=False) 
  27         uploader 
= self
._html
_search
_regex
(r
'<div class="user">.*?<h2>(.+?)</h2>', 
  28             webpage
, u
'uploader', fatal
=False, flags
=re
.DOTALL
) 
  35             'thumbnail': thumbnail
,