]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/motorsport.py
3 from . common
import InfoExtractor
6 class MotorsportIE ( InfoExtractor
):
8 IE_DESC
= 'motorsport.com'
9 _VALID_URL
= r
'https?://(?:www\.)?motorsport\.com/[^/?#]+/video/(?:[^/?#]+/)(?P<id>[^/]+)/?(?:$|[?#])'
11 'url' : 'http://www.motorsport.com/f1/video/main-gallery/red-bull-racing-2014-rules-explained/' ,
15 'title' : 'Red Bull Racing: 2014 Rules Explained' ,
17 '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.' ,
18 'uploader' : 'mcomstaff' ,
19 'uploader_id' : 'UC334JIYKkVnyFoNCclfZtHQ' ,
20 'upload_date' : '20140903' ,
21 'thumbnail' : r
're:^https?://.+\.jpg$' ,
23 'add_ie' : [ 'Youtube' ],
25 'skip_download' : True ,
29 def _real_extract ( self
, url
):
30 display_id
= self
._ match
_ id
( url
)
31 webpage
= self
._ download
_ webpage
( url
, display_id
)
33 iframe_path
= self
._ html
_ search
_ regex
(
34 r
'<iframe id="player_iframe"[^>]+src="([^"]+)"' , webpage
, 'iframe path' , default
= None )
36 if iframe_path
is None :
37 iframe_path
= self
._ html
_ search
_ regex
(
38 r
'<iframe [^>]*\bsrc="(https://motorsport\.tv/embed/[^"]+)' , webpage
, 'embed iframe path' )
39 return self
. url_result ( iframe_path
)
41 iframe
= self
._ download
_ webpage
(
42 urllib
. parse
. urljoin ( url
, iframe_path
), display_id
,
44 youtube_id
= self
._ search
_ regex
(
45 r
'www.youtube.com/embed/(. {11} )' , iframe
, 'youtube id' )
48 '_type' : 'url_transparent' ,
49 'display_id' : display_id
,
50 'url' : f
'https://youtube.com/watch?v= {youtube_id} ' ,