1 from .common
import InfoExtractor
7 class MotorsportIE(InfoExtractor
):
9 IE_DESC
= 'motorsport.com'
10 _VALID_URL
= r
'https?://(?:www\.)?motorsport\.com/[^/?#]+/video/(?:[^/?#]+/)(?P<id>[^/]+)/?(?:$|[?#])'
12 'url': 'http://www.motorsport.com/f1/video/main-gallery/red-bull-racing-2014-rules-explained/',
16 'title': 'Red Bull Racing: 2014 Rules Explained',
18 '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.',
19 'uploader': 'mcomstaff',
20 'uploader_id': 'UC334JIYKkVnyFoNCclfZtHQ',
21 'upload_date': '20140903',
22 'thumbnail': r
're:^https?://.+\.jpg$'
24 'add_ie': ['Youtube'],
26 'skip_download': True,
30 def _real_extract(self
, url
):
31 display_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, display_id
)
34 iframe_path
= self
._html
_search
_regex
(
35 r
'<iframe id="player_iframe"[^>]+src="([^"]+)"', webpage
, 'iframe path', default
=None)
37 if iframe_path
is None:
38 iframe_path
= self
._html
_search
_regex
(
39 r
'<iframe [^>]*\bsrc="(https://motorsport\.tv/embed/[^"]+)', webpage
, 'embed iframe path')
40 return self
.url_result(iframe_path
)
42 iframe
= self
._download
_webpage
(
43 compat_urlparse
.urljoin(url
, iframe_path
), display_id
,
45 youtube_id
= self
._search
_regex
(
46 r
'www.youtube.com/embed/(.{11})', iframe
, 'youtube id')
49 '_type': 'url_transparent',
50 'display_id': display_id
,
51 'url': 'https://youtube.com/watch?v=%s' % youtube_id
,