lmmfranco / nintendo-switch-eshop

Crawler for Nintendo Switch eShop
Apache License 2.0
519 stars 82 forks source link

[Question]: Not getting all games from `getGamesAmerica` #215

Closed jiaozihan closed 4 years ago

jiaozihan commented 4 years ago

Please describe the problem you are having in as much detail as possible:

getGamesAmerica() doesn't return games beyond 'c'

Hi guys thank you for maintaining this project. I'm using a for loop to handle pagination but it stopped at

CAN ANDROIDS PRAY:BLUE \n Candle: The Power of the Flame \n Candleman \n Candy Hoarder \n Candy Match 3 \n Candy, Please! \n Cannibal Cuisine \n Capcom Beat 'Em Up Bundle \n Captain America: Super Soldier \n Captain Cat \n Captain StarONE \n Captain Toad: Treasure Tracker \n Captain Toad: Treasure Tracker \n Captain Toad: Treasure Tracker \n Car Battler Joe \n Car Mayhem \n Car Mechanic Manager \n Car Mechanic Simulator

No games after 'Car Mechanic Simulator' is returned. Any suggestions?

Further details:

favna commented 4 years ago

Hi there,

I just tried using getGamesAmerica myself and the last entry I get is YouTube. This is the code I used:

impl.mjswith NodeJS 14 or higher run with node --experimental-top-level-await impl.mjs

import pkg from 'nintendo-switch-eshop';

const games = await pkg.getGamesAmerica();

const lastGame = games.slice(-1);
const foundGame = games.find((game) => game.title === 'Car Mechanic Simulator');

console.log(foundGame); // This is your game
console.log('===========');
console.log(lastGame);

Result of console.log(lastGame):

// ❯ node --experimental-top-level-await .\impl.mjs
[
  {
    type: 'game',
    locale: 'en_US',
    url: '/games/detail/youtube-switch',
    title: 'YouTube',
    description: 'Enjoy entertainment like music videos and shows, plus gaming \n' +
      '      livestreams, how-tos and much more. Explore a world of videos with \n' +
      '      recommendations and easy access to your channel subscriptions. So grab \n' +
      '      your friends, family, and your Nintendo Switch controller, and enjoy \n' +
      '      YouTube together.',
    lastModified: 1569957018124,
    id: 'j8bMWjvvATPpmd0skHi4wKSBuetiqxxm',
    nsuid: '70010000014303',
    slug: 'youtube-switch',
    boxArt: '/content/dam/noa/en_US/games/switch/y/youtube-switch/Switch_YouTube_box_eShop.png',
    gallery: '/content/dam/noa/en_US/games/switch/y/youtube-switch/screenshot-gallery/Switch_YouTube_01.jpg',
    platform: 'Nintendo Switch',
    releaseDateMask: '2018-11-08T00:00:00.000Z',
    characters: [],
    categories: [ 'Video' ],
    msrp: 0,
    esrb: 'Teen',
    esrbDescriptors: [ 'Users Interact' ],
    virtualConsole: 'na',
    generalFilters: [],
    filterShops: [],
    filterPlayers: [],
    publishers: [ 'Google' ],
    players: '1 player',
    featured: false,
    freeToStart: true,
    priceRange: 'Free to start',
    salePrice: null,
    availability: [ 'Available now' ],
    objectID: '92d6be06-3e91-3d95-a01e-d05d1064481b',
    _distinctSeqID: 0,
    _highlightResult: {
      title: [Object],
      id: [Object],
      nsuid: [Object],
      publishers: [Array]
    }
  }
]


const { getGamesAmerica } = require('nintendo-switch-eshop');

async function getGames() {
  const games = await getGamesAmerica();

  const gameNames = games.map((game) => game.title);

  return gameNames.join('\n'); // To get your new line delimited list again
}