]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nintendo.py
Prepare new release.
[youtubedl] / youtube_dl / extractor / nintendo.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7 from .ooyala import OoyalaIE
8 from ..utils import unescapeHTML
9
10
11 class NintendoIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?nintendo\.com/games/detail/(?P<id>[^/?#&]+)'
13 _TESTS = [{
14 'url': 'http://www.nintendo.com/games/detail/yEiAzhU2eQI1KZ7wOHhngFoAHc1FpHwj',
15 'info_dict': {
16 'id': 'MzMmticjp0VPzO3CCj4rmFOuohEuEWoW',
17 'ext': 'flv',
18 'title': 'Duck Hunt Wii U VC NES - Trailer',
19 'duration': 60.326,
20 },
21 'params': {
22 'skip_download': True,
23 },
24 'add_ie': ['Ooyala'],
25 }, {
26 'url': 'http://www.nintendo.com/games/detail/tokyo-mirage-sessions-fe-wii-u',
27 'info_dict': {
28 'id': 'tokyo-mirage-sessions-fe-wii-u',
29 'title': 'Tokyo Mirage Sessions ♯FE',
30 },
31 'playlist_count': 3,
32 }]
33
34 def _real_extract(self, url):
35 page_id = self._match_id(url)
36
37 webpage = self._download_webpage(url, page_id)
38
39 entries = [
40 OoyalaIE._build_url_result(m.group('code'))
41 for m in re.finditer(
42 r'class=(["\'])embed-video\1[^>]+data-video-code=(["\'])(?P<code>(?:(?!\2).)+)\2',
43 webpage)]
44
45 return self.playlist_result(
46 entries, page_id, unescapeHTML(self._og_search_title(webpage, fatal=False)))