aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/nintendo.py
diff options
context:
space:
mode:
authorTRox1972 <TRox1972@users.noreply.github.com>2016-07-03 00:39:35 +0200
committerSergey M․ <dstftw@gmail.com>2016-07-16 23:58:53 +0700
commita2f9ca1e67e6b926957abe3b35a4d78355bef7d4 (patch)
tree0038b327de06c5283dca719a651c0873093f589a /youtube_dl/extractor/nintendo.py
parent371ddb14fe651d4a1e5a8310d6d7c0e395cd92b0 (diff)
downloadyoutube-dl-a2f9ca1e67e6b926957abe3b35a4d78355bef7d4.tar.xz
[nintendo] Add extractor
Diffstat (limited to 'youtube_dl/extractor/nintendo.py')
-rw-r--r--youtube_dl/extractor/nintendo.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/youtube_dl/extractor/nintendo.py b/youtube_dl/extractor/nintendo.py
new file mode 100644
index 000000000..57333ada0
--- /dev/null
+++ b/youtube_dl/extractor/nintendo.py
@@ -0,0 +1,47 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from .ooyala import OoyalaIE
+
+import re
+
+
+class NintendoIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nintendo\.com/games/detail/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://www.nintendo.com/games/detail/yEiAzhU2eQI1KZ7wOHhngFoAHc1FpHwj',
+ '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',
+ },
+ 'params': {
+ 'skip_download': True,
+ },
+ 'add_ie': ['Ooyala'],
+ 'playlist_count': 4,
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ ooyala_codes = re.findall(
+ r'data-video-code=(["\'])(?P<code>.+?)\1',
+ webpage)
+
+ entries = []
+ for ooyala_code in ooyala_codes:
+ entries.append(OoyalaIE._build_url_result(ooyala_code[1]))
+
+ return self.playlist_result(entries, video_id, self._og_search_title(webpage))