From d84d4f17c3082d63a0deda90396f34538eb0912b Mon Sep 17 00:00:00 2001 From: mttronc Date: Tue, 11 Sep 2018 11:26:48 +0200 Subject: [PATCH] [wwe] Resolve requested issues --- youtube_dl/extractor/wwe.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/wwe.py b/youtube_dl/extractor/wwe.py index 6679f74b1..c471a79f5 100644 --- a/youtube_dl/extractor/wwe.py +++ b/youtube_dl/extractor/wwe.py @@ -1,19 +1,21 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import ExtractorError +from ..compat import compat_str +from ..utils import urljoin class WWEIE(InfoExtractor): _VALID_URL = r'https?://(?:\w+\.)?wwe.com/(?:.*/)?videos/(?P[\w-]+)' _TESTS = [{ 'url': 'https://www.wwe.com/videos/daniel-bryan-vs-andrade-cien-almas-smackdown-live-sept-4-2018', + 'md5': '30cbc824b51f4010ea885bfcaec76972', 'info_dict': { - 'id': 'sd994_bryan_almas_090418', + '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': 'https://www.wwe.com/f/styles/wwe_16_9_s/public/2018/09/20180904_sd_danielalmas--d97661dd31eea8a99837a3dbc7121f8f.jpg', + 'thumbnail': r're:^https?://.*\.jpg$', } }, { 'url': 'https://de.wwe.com/videos/gran-metalik-vs-tony-nese-wwe-205-live-sept-4-2018', @@ -33,17 +35,14 @@ class WWEIE(InfoExtractor): player = drupal_settings['WWEVideoLanding']['initialVideo'] metadata = player['playlist'][0] - if metadata.get('file') is None: - raise ExtractorError('Unable to extract video url') - + id = compat_str(metadata['nid']) title = metadata.get('title') or self._og_search_title(webpage) - video_url = 'https:' + metadata.get('file') + video_url = 'https:' + metadata['file'] thumbnail = None if metadata.get('image') is not None: - thumbnail = 'https://www.wwe.com' + metadata.get('image') + thumbnail = urljoin(url, metadata.get('image')) description = metadata.get('description') - id = self._generic_id(video_url) formats = self._extract_m3u8_formats(video_url, id, 'mp4') return {