]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/statigram.py
95d2ee3c046fa70289fc5ab07e7062db7a66f047
   3 from .common 
import InfoExtractor
 
   5 class StatigramIE(InfoExtractor
): 
   6     _VALID_URL 
= r
'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)' 
   8     def _real_extract(self
, url
): 
   9         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  10         video_id 
= mobj
.group(1) 
  11         webpage 
= self
._download
_webpage
(url
, video_id
) 
  12         video_url 
= self
._html
_search
_regex
( 
  13             r
'<meta property="og:video:secure_url" content="(.+?)">', 
  14             webpage
, u
'video URL') 
  15         thumbnail_url 
= self
._html
_search
_regex
( 
  16             r
'<meta property="og:image" content="(.+?)" />', 
  17             webpage
, u
'thumbnail URL', fatal
=False) 
  18         html_title 
= self
._html
_search
_regex
( 
  19             r
'<title>(.+?)</title>', 
  21         title 
= html_title
.rpartition(u
' | Statigram')[0] 
  22         uploader_id 
= self
._html
_search
_regex
( 
  23             r
'@([^ ]+)', title
, u
'uploader name', fatal
=False) 
  31             'thumbnail': thumbnail_url
, 
  32             'uploader_id' : uploader_id