mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-30 07:38:18 +01:00
[wwe] Add extractor
This commit is contained in:
parent
a640c4d226
commit
11d19ff503
|
@ -1386,6 +1386,7 @@ from .wsj import (
|
||||||
WSJIE,
|
WSJIE,
|
||||||
WSJArticleIE,
|
WSJArticleIE,
|
||||||
)
|
)
|
||||||
|
from .wwe import WWEIE
|
||||||
from .xbef import XBefIE
|
from .xbef import XBefIE
|
||||||
from .xboxclips import XboxClipsIE
|
from .xboxclips import XboxClipsIE
|
||||||
from .xfileshare import XFileShareIE
|
from .xfileshare import XFileShareIE
|
||||||
|
|
56
youtube_dl/extractor/wwe.py
Normal file
56
youtube_dl/extractor/wwe.py
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
|
from ..utils import urljoin
|
||||||
|
|
||||||
|
|
||||||
|
class WWEIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:\w+\.)?wwe.com/(?:.*/)?videos/(?P<id>[\w-]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.wwe.com/videos/daniel-bryan-vs-andrade-cien-almas-smackdown-live-sept-4-2018',
|
||||||
|
'md5': '30cbc824b51f4010ea885bfcaec76972',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '40048199',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Daniel Bryan vs. Andrade "Cien" Almas: SmackDown LIVE, Sept. 4, 2018',
|
||||||
|
'description': 'Still fuming after he and his wife Brie Bella were attacked by The Miz and Maryse last week, Daniel Bryan takes care of some unfinished business with Andrade "Cien" Almas.',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'https://de.wwe.com/videos/gran-metalik-vs-tony-nese-wwe-205-live-sept-4-2018',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
display_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
drupal_settings = self._parse_json(
|
||||||
|
self._html_search_regex(
|
||||||
|
r'(?s)Drupal\.settings\s*,\s*({.+?})\);',
|
||||||
|
webpage, 'drupal settings'),
|
||||||
|
display_id)
|
||||||
|
|
||||||
|
player = drupal_settings['WWEVideoLanding']['initialVideo']
|
||||||
|
metadata = player['playlist'][0]
|
||||||
|
|
||||||
|
id = compat_str(metadata['nid'])
|
||||||
|
title = metadata.get('title') or self._og_search_title(webpage)
|
||||||
|
video_url = 'https:' + metadata['file']
|
||||||
|
thumbnail = None
|
||||||
|
if metadata.get('image') is not None:
|
||||||
|
thumbnail = urljoin(url, metadata.get('image'))
|
||||||
|
description = metadata.get('description')
|
||||||
|
|
||||||
|
formats = self._extract_m3u8_formats(video_url, id, 'mp4')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'url': video_url,
|
||||||
|
'display_id': display_id,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'description': description,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user