PokeAPI / pokeapi

The Pokémon API
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
4.33k stars 954 forks source link

Sword & Shield Pokemon #460

Closed karsvaniersel closed 3 years ago

karsvaniersel commented 4 years ago

When will the Sword & Shield Pokemon be added? And how can I help speed up the process? :)

blevy115 commented 4 years ago

I think they're waiting on the data from veekun

Naramsim commented 4 years ago

Yes, we are waiting for https://github.com/veekun/pokedex to update their CSV files. We are based on the data they provide.

You can track their issue here: https://github.com/veekun/pokedex/issues/284

karsvaniersel commented 4 years ago

Ah thanks! Ye not really familiar how Veekun is getting their data, else i would love to help. I do see some sites having the Sword and Shield data, but they probably have their own data set

Naramsim commented 4 years ago

They get the data from

  1. Looking into pokemon Nintendo games
  2. Manually

So it's a long and difficult process

karsvaniersel commented 4 years ago

Ah ye I wonder how people can parse the game data and convert it to CSV. Maybe should link into that sometimes, do you have any experience with that?

Naramsim commented 4 years ago

Nope, at all :(

binaryminutia0l commented 4 years ago

If it helps anyone, here is json and sprites for the 8th gen Pokemon. The json is just id, name and type names, as that's all I needed. The sprites are also a bit small, as that's all I could source easily.

8th-gen-pokemon.zip

Also here's the Node script I used to scrape it from Bulbapedia:

const cheerio = require('cheerio')
const https = require('https')

const get = (url, binary) => new Promise((resolve, reject) => {
  https
    .get(url, resp => {
      if (binary) {
        resp.setEncoding('binary')
      }
      let data = ''
      resp.on('data', (chunk) => {
        data += chunk
      })
      resp.on('end', () => {
        resolve(data)
      })
    })
    .on('error', err => {
      throw err
    })
})

const get8thGenPokemon = async () => {
  const html = await get([
    'https://bulbapedia.bulbagarden.net',
    '/wiki/List_of_Pokémon_by_index_number_(Generation_VIII)'
  ].join(''))
  const $ = cheerio.load(html)
  const pokemon = {}
  $('#mw-content-text table.roundy tr').each((i, row) => {
    const cells = $(row).find('td')
    if (!cells.length) {
      return
    }
    const id = $(cells[1]).text().trim()
    if (id < 810) {
      // 810 Grookey is the first Gen 8 pokemon
      return
    }
    // TODO get higher res images
    const image = $(cells[2]).find('img').attr('src')
    const name = $(cells[3]).text().trim()
    const types = []
    cells.each((i, cell) => {
      if (i < 4) {
        return
      }
      const type = $(cell).text().toLowerCase().trim()
      if (types.indexOf(type) > -1) {
        return
      }
      types.push(type)
    })
    pokemon[id] = {
      image,
      name,
      types
    }
  })
  return pokemon
}

module.exports = {
  get,
  get8thGenPokemon
}
route1rodent commented 4 years ago

meanwhile we get veekun/pokedex ready, I have prepared a project and a JSON with all gen 8 Pokemon and stats https://github.com/route1rodent/swordshield-data/blob/master/data/json/pokemon.json

we are working on porting the data to veekun/pokedex soon-ish

Naramsim commented 4 years ago

Nice one, where are you fetching the data from?

route1rodent commented 4 years ago

@Naramsim from @ SciresM and @ Kaphotics on Twitter, who always rip the data and sprites from the original games.

The JSON file I posted is just the result of parsing and processing some of that data (concretely Sword/Shield Pokemon Stats, Learnsets and Evolutions) , which I am doing in that repository.

skylarr1227 commented 4 years ago

Very good an accurate. I have all the gen 8 sprites (gif format) in a much more hd form if you would like or if it would help I can make a repository for this (or just give you the link to our webserver)

dreki commented 4 years ago

Good work, y’all. Let me know if I can help at all. I built https://pokedecks.now.sh and am very thankful for PokeAPI. I’ll help in any way I can.

Update: I've been able to bring Sword & Shield Pokémon into my site: https://pokedecks.now.sh/pokemon/812

I have classic (pre-gen 8) Pokémon coming from PokeAPI and gen 8 Pokémon coming from local data files, and they're both served by one unifying GraphQL service.

Naramsim commented 4 years ago

Cool @dreki, two questions:

Which data did you use for sword and shield?

Did you use Pokeapi's branch for GraphQL?

Thanks

takeshi-codes commented 4 years ago

I know it'd be a large undertaking, but have you considered switching from veekun to smogon's API? it seems to be more up to date.

Naramsim commented 4 years ago

No, we haven't considered it. I didn't even know that Smogon is offering a set of APIs, could you post a link to these ones?

I also think that Smogon data could be significantly different from the one of Veekun, different in format and different in variety (I expect much more pokemon-battle related data than general-data such as the one we are currently offering)

takeshi-codes commented 4 years ago

They don't have explicit APIs per-se, but the repo itself has typescript files that contains the data they use.

As for format and variety of the data, it is structured differently than that of Veekun. Although having the data at hand vs having to manually add/create the csv files, you could probably automate a good chunk of what you need done.

Given that this is a python-based repo, it would take a bit for me to get ramped up as I don't really know python, I primarily work in js. But I am willing to help, I use PokeAPI A LOT.

Naramsim commented 4 years ago

It would be cool to understand how do they get their data. If they get it automatically using a script then we could use the same source to update Veekun's data. Or maybe they add all the data manually. I don't know

I took a look at their data and, in the end, they only have a small chunk of Pokemon data, only the one needed for battles. And that data is also tuned by them to make fair battles.

allowthisfam commented 4 years ago

Bump. Really like the Pokédex bot on Discord and would very like to see Gen 8 (up to atleast Zarude, if not Calyrex) added! I'm aware of PokéAPI / Vekkun etc. Just hope it's not forgotten...

Naramsim commented 4 years ago

Hello to everyone in this long and old thread. I wanted to inform you that PokeAPI has new plans for updating the data with the new generation-8 one. We thought about relying a bit more on the PokeAPI community and allow it to contribute to the data we serve.

So, temporary, we will have our own veekun/pokedex fork, new data (taken from other sources than Veekun) can be submitted over there.

If you are interested in contributing, you are more than welcome! Please read this issue: https://github.com/PokeAPI/pokeapi/issues/520

Just as a PoC we've scraped Bulbapedia for the new gen-8 pokemons and we've added some of their properties to the API. https://pokeapi.co/api/v2/generation/8/

@karsvaniersel @sfyfedotcom @route1rodent @skylarr1227(for the sprites), @dreki

Thanks to everyone!!

PS: I'll still have this issue open until Veekun will release all the data.

Naramsim commented 3 years ago

Closing since we added gen-8 pokemons.

For other gen-8 data, please look at https://github.com/PokeAPI/pokeapi/issues/520