2016-07-17 02:01:25 +09:00
|
|
|
# coding: utf-8
|
2016-07-03 07:39:35 +09:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-07-17 02:01:25 +09:00
|
|
|
import re
|
|
|
|
|
2016-07-03 07:39:35 +09:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from .ooyala import OoyalaIE
|
|
|
|
|
|
|
|
|
|
|
|
class NintendoIE(InfoExtractor):
|
2019-12-01 07:48:26 +09:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?nintendo\.com/(?:games/detail|nintendo-direct)/(?P<id>[^/?#&]+)'
|
2016-07-03 07:39:35 +09:00
|
|
|
_TESTS = [{
|
2019-12-01 07:48:26 +09:00
|
|
|
'url': 'https://www.nintendo.com/games/detail/duck-hunt-wii-u/',
|
2016-07-03 07:39:35 +09:00
|
|
|
'info_dict': {
|
|
|
|
'id': 'MzMmticjp0VPzO3CCj4rmFOuohEuEWoW',
|
|
|
|
'ext': 'flv',
|
|
|
|
'title': 'Duck Hunt Wii U VC NES - Trailer',
|
|
|
|
'duration': 60.326,
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
'add_ie': ['Ooyala'],
|
|
|
|
}, {
|
|
|
|
'url': 'http://www.nintendo.com/games/detail/tokyo-mirage-sessions-fe-wii-u',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'tokyo-mirage-sessions-fe-wii-u',
|
2016-07-17 02:01:25 +09:00
|
|
|
'title': 'Tokyo Mirage Sessions ♯FE',
|
2016-07-03 07:39:35 +09:00
|
|
|
},
|
2019-12-01 07:48:26 +09:00
|
|
|
'playlist_count': 4,
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.nintendo.com/nintendo-direct/09-04-2019/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Switch_ROS_ND0904-H264.mov',
|
|
|
|
'duration': 2324.758,
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
'add_ie': ['Ooyala'],
|
2016-07-03 07:39:35 +09:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-07-17 02:01:25 +09:00
|
|
|
page_id = self._match_id(url)
|
2016-07-03 07:39:35 +09:00
|
|
|
|
2016-07-17 02:01:25 +09:00
|
|
|
webpage = self._download_webpage(url, page_id)
|
2016-07-03 07:39:35 +09:00
|
|
|
|
2016-07-17 02:01:25 +09:00
|
|
|
entries = [
|
|
|
|
OoyalaIE._build_url_result(m.group('code'))
|
|
|
|
for m in re.finditer(
|
2019-12-01 07:48:26 +09:00
|
|
|
r'data-(?:video-id|directVideoId)=(["\'])(?P<code>(?:(?!\1).)+)\1', webpage)]
|
|
|
|
|
|
|
|
title = self._html_search_regex(
|
|
|
|
r'(?s)<(?:span|div)[^>]+class="(?:title|wrapper)"[^>]*>.*?<h1>(.+?)</h1>',
|
|
|
|
webpage, 'title', fatal=False)
|
2016-07-03 07:39:35 +09:00
|
|
|
|
2016-07-17 02:01:25 +09:00
|
|
|
return self.playlist_result(
|
2019-12-01 07:48:26 +09:00
|
|
|
entries, page_id, title)
|