You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from .ooyala import OoyalaIE
  6. from ..utils import unescapeHTML
  7. class NintendoIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www\.)?nintendo\.com/games/detail/(?P<id>[^/?#&]+)'
  9. _TESTS = [{
  10. 'url': 'http://www.nintendo.com/games/detail/yEiAzhU2eQI1KZ7wOHhngFoAHc1FpHwj',
  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',
  25. 'title': 'Tokyo Mirage Sessions ♯FE',
  26. },
  27. 'playlist_count': 3,
  28. }]
  29. def _real_extract(self, url):
  30. page_id = self._match_id(url)
  31. webpage = self._download_webpage(url, page_id)
  32. entries = [
  33. OoyalaIE._build_url_result(m.group('code'))
  34. for m in re.finditer(
  35. r'class=(["\'])embed-video\1[^>]+data-video-code=(["\'])(?P<code>(?:(?!\2).)+)\2',
  36. webpage)]
  37. return self.playlist_result(
  38. entries, page_id, unescapeHTML(self._og_search_title(webpage, fatal=False)))