]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/nintendo.py
[nintendo] Add extractor
[yt-dlp.git] / youtube_dl / extractor / nintendo.py
CommitLineData
a2f9ca1e
T
1from __future__ import unicode_literals
2
3from .common import InfoExtractor
4from .ooyala import OoyalaIE
5
6import re
7
8
9class NintendoIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?nintendo\.com/games/detail/(?P<id>[\w-]+)'
11 _TESTS = [{
12 'url': 'http://www.nintendo.com/games/detail/yEiAzhU2eQI1KZ7wOHhngFoAHc1FpHwj',
13 'info_dict': {
14 'id': 'MzMmticjp0VPzO3CCj4rmFOuohEuEWoW',
15 'ext': 'flv',
16 'title': 'Duck Hunt Wii U VC NES - Trailer',
17 'duration': 60.326,
18 },
19 'params': {
20 'skip_download': True,
21 },
22 'add_ie': ['Ooyala'],
23 }, {
24 'url': 'http://www.nintendo.com/games/detail/tokyo-mirage-sessions-fe-wii-u',
25 'info_dict': {
26 'id': 'tokyo-mirage-sessions-fe-wii-u',
27 },
28 'params': {
29 'skip_download': True,
30 },
31 'add_ie': ['Ooyala'],
32 'playlist_count': 4,
33 }]
34
35 def _real_extract(self, url):
36 video_id = self._match_id(url)
37 webpage = self._download_webpage(url, video_id)
38
39 ooyala_codes = re.findall(
40 r'data-video-code=(["\'])(?P<code>.+?)\1',
41 webpage)
42
43 entries = []
44 for ooyala_code in ooyala_codes:
45 entries.append(OoyalaIE._build_url_result(ooyala_code[1]))
46
47 return self.playlist_result(entries, video_id, self._og_search_title(webpage))