]>
Commit | Line | Data |
---|---|---|
49bc16b9 S |
1 | import re |
2 | ||
a2f9ca1e T |
3 | from .common import InfoExtractor |
4 | from .ooyala import OoyalaIE | |
a2f9ca1e T |
5 | |
6 | ||
7 | class NintendoIE(InfoExtractor): | |
ddfe5019 | 8 | _VALID_URL = r'https?://(?:www\.)?nintendo\.com/(?:games/detail|nintendo-direct)/(?P<id>[^/?#&]+)' |
a2f9ca1e | 9 | _TESTS = [{ |
ddfe5019 | 10 | 'url': 'https://www.nintendo.com/games/detail/duck-hunt-wii-u/', |
a2f9ca1e T |
11 | 'info_dict': { |
12 | 'id': 'MzMmticjp0VPzO3CCj4rmFOuohEuEWoW', | |
13 | 'ext': 'flv', | |
14 | 'title': 'Duck Hunt Wii U VC NES - Trailer', | |
15 | 'duration': 60.326, | |
16 | }, | |
17 | 'params': { | |
18 | 'skip_download': True, | |
19 | }, | |
20 | 'add_ie': ['Ooyala'], | |
21 | }, { | |
22 | 'url': 'http://www.nintendo.com/games/detail/tokyo-mirage-sessions-fe-wii-u', | |
23 | 'info_dict': { | |
24 | 'id': 'tokyo-mirage-sessions-fe-wii-u', | |
49bc16b9 | 25 | 'title': 'Tokyo Mirage Sessions ♯FE', |
a2f9ca1e | 26 | }, |
ddfe5019 RA |
27 | 'playlist_count': 4, |
28 | }, { | |
29 | 'url': 'https://www.nintendo.com/nintendo-direct/09-04-2019/', | |
30 | 'info_dict': { | |
31 | 'id': 'J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V', | |
32 | 'ext': 'mp4', | |
33 | 'title': 'Switch_ROS_ND0904-H264.mov', | |
34 | 'duration': 2324.758, | |
35 | }, | |
36 | 'params': { | |
37 | 'skip_download': True, | |
38 | }, | |
39 | 'add_ie': ['Ooyala'], | |
a2f9ca1e T |
40 | }] |
41 | ||
42 | def _real_extract(self, url): | |
49bc16b9 | 43 | page_id = self._match_id(url) |
a2f9ca1e | 44 | |
49bc16b9 | 45 | webpage = self._download_webpage(url, page_id) |
a2f9ca1e | 46 | |
49bc16b9 S |
47 | entries = [ |
48 | OoyalaIE._build_url_result(m.group('code')) | |
49 | for m in re.finditer( | |
ddfe5019 RA |
50 | r'data-(?:video-id|directVideoId)=(["\'])(?P<code>(?:(?!\1).)+)\1', webpage)] |
51 | ||
52 | title = self._html_search_regex( | |
53 | r'(?s)<(?:span|div)[^>]+class="(?:title|wrapper)"[^>]*>.*?<h1>(.+?)</h1>', | |
54 | webpage, 'title', fatal=False) | |
a2f9ca1e | 55 | |
49bc16b9 | 56 | return self.playlist_result( |
ddfe5019 | 57 | entries, page_id, title) |