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