]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/veoh.py 
 
 
 
 
 
 
 
 
   1  from  __future__ 
import  unicode_literals
 
   6  from  . common 
import  InfoExtractor
 
   9  class  VeohIE ( InfoExtractor
):  
  10      _VALID_URL 
=  r
'http://(?:www\.)?veoh\.com/(?:watch|iphone/#_Watch)/v(?P<id>\d*)'  
  13          'url' :  'http://www.veoh.com/watch/v56314296nk7Zdmz3' ,  
  14          'file' :  '56314296.mp4' ,  
  15          'md5' :  '620e68e6a3cff80086df3348426c9ca3' ,  
  17              'title' :  'Straight Backs Are Stronger' ,  
  18              'uploader' :  'LUMOback' ,  
  19              'description' :  'At LUMOback, we believe straight backs are stronger.  The LUMOback Posture & Movement Sensor:  It gently vibrates when you slouch, inspiring improved posture and mobility.  Use the app to track your data and improve your posture over time. ' ,  
  23      def  _real_extract ( self
,  url
):  
  24          mobj 
=  re
. match ( self
._ VALID
_U RL
,  url
)  
  25          video_id 
=  mobj
. group ( 'id' )  
  26          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  
  28          m_youtube 
=  re
. search ( r
'http://www\.youtube\.com/v/(.*?)(\&|")' ,  webpage
)  
  29          if  m_youtube 
is not None :  
  30              youtube_id 
=  m_youtube
. group ( 1 )  
  31              self
. to_screen ( ' %s : detected Youtube video.'  %  video_id
)  
  32              return  self
. url_result ( youtube_id
,  'Youtube' )  
  34          self
. report_extraction ( video_id
)  
  35          info 
=  self
._ search
_ regex
( r
'videoDetailsJSON = \' ({.* ?
}) \' ; ', webpage, ' info
')  
  36          info = json.loads(info)  
  37          video_url = info.get(' fullPreviewHashHighPath
') or info.get(' fullPreviewHashLowPath
')  
  40              ' id ': info[' videoId
'],  
  41              ' title
': info[' title
'],  
  43              ' uploader
': info[' username
'],  
  44              ' thumbnail
': info.get(' highResImage
') or info.get(' medResImage
'),  
  45              ' description
': info[' description
'],  
  46              ' view_count
': info[' views
'],