]>
 
 
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/motorsport.py 
 
 
 
 
 
 
 
 
   2  from  __future__ 
import  unicode_literals
 
   4  from  . common 
import  InfoExtractor
 
  10  class  MotorsportIE ( InfoExtractor
):  
  11      IE_DESC 
=  'motorsport.com'  
  12      _VALID_URL 
=  r
'http://www\.motorsport\.com/[^/?#]+/video/(?:[^/?#]+/)(?P<id>[^/]+)/?(?:$|[?#])'  
  14          'url' :  'http://www.motorsport.com/f1/video/main-gallery/red-bull-racing-2014-rules-explained/' ,  
  18              'title' :  'Red Bull Racing: 2014 Rules Explained' ,  
  20              'description' :  'A new clip from Red Bull sees Daniel Ricciardo and Sebastian Vettel explain the 2014 Formula One regulations – which are arguably the most complex the sport has ever seen.' ,  
  21              'uploader' :  'mcomstaff' ,  
  22              'uploader_id' :  'UC334JIYKkVnyFoNCclfZtHQ' ,  
  23              'upload_date' :  '20140903' ,  
  24              'thumbnail' :  r
're:^https?://.+\.jpg$'  
  26          'add_ie' : [ 'Youtube' ],  
  28              'skip_download' :  True ,  
  32      def  _real_extract ( self
,  url
):  
  33          display_id 
=  self
._ match
_ id
( url
)  
  34          webpage 
=  self
._ download
_ webpage
( url
,  display_id
)  
  36          iframe_path 
=  self
._ html
_ search
_ regex
(  
  37              r
'<iframe id="player_iframe"[^>]+src="([^"]+)"' ,  webpage
,  
  39          iframe 
=  self
._ download
_ webpage
(  
  40              compat_urlparse
. urljoin ( url
,  iframe_path
),  display_id
,  
  42          youtube_id 
=  self
._ search
_ regex
(  
  43              r
'www.youtube.com/embed/(. {11} )' ,  iframe
,  'youtube id' )  
  46              '_type' :  'url_transparent' ,  
  47              'display_id' :  display_id
,  
  48              'url' :  'https://youtube.com/watch?v= %s '  %  youtube_id
,