Skip to content

Conversation

@WyattC16
Copy link
Contributor

add lumiose city pokedex and new megas

Copy link

@lutfunjoya-netizen lutfunjoya-netizen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legends Z-A was released. I hope it brings us joy.

lutfunjoya-netizen

This comment was marked as spam.

Copy link

@lutfunjoya-netizen lutfunjoya-netizen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legends Z-A is released, so it means it can be approved.

Copy link

@lutfunjoya-netizen lutfunjoya-netizen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WyattC16 Your support means much more to me.

@phalt
Copy link
Member

phalt commented Oct 17, 2025

Can I ask where this data was sourced from? We can make edits if things are wrong, but I'd prefer to be closer to 95%-99% correct the first time.

@WyattC16
Copy link
Contributor Author

Can I ask where this data was sourced from? We can make edits if things are wrong, but I'd prefer to be closer to 95%-99% correct the first time.

For the most part, I used some JavaScript to scrape the data off of serebii.net. Below is a summary of how each file was updated.

  1. pokedex_version_groups.csv - manually updated
  2. pokedexes.csv - manually updated
  3. pokemon.csv - mostly automated. Weight and Height were entered manually after running the script.
  4. pokemon_dex_numbers.csv - fully automated
  5. pokemon_stats.csv - fully automated
  6. pokemon_types.csv - fully automated
  7. version_groups.csv - manually updated
  8. version_names.csv - manually updated
  9. versions.csv - manually updated

Here are the two pages I pulled from. The available Pokémon was used to populate pokemon_dex_numbers.csv. The rest of the of the files were populated from the Mega Evolutions page.

  1. https://www.serebii.net/legendsz-a/megaevolutions.shtml
  2. https://www.serebii.net/legendsz-a/availablepokemon.shtml

Below is the JavaScript I used.

//Copy code
async function copyTextToClipboard(text) {
  try {
    await navigator.clipboard.writeText(text);
    console.log('Text copied to clipboard successfully!');
  } catch (err) {
    console.error('Failed to copy text: ', err);
    // Fallback for older browsers or if Clipboard API is not available/permitted
    fallbackCopyToClipboard(text);
  }
}

// Fallback function for older browsers (using document.execCommand)
function fallbackCopyToClipboard(text) {
  const textArea = document.createElement("textarea");
  textArea.value = text;

  // Make the textarea invisible
  textArea.style.position = "fixed";
  textArea.style.top = "0";
  textArea.style.left = "0";
  textArea.style.width = "2em";
  textArea.style.height = "2em";
  textArea.style.padding = "0";
  textArea.style.border = "none";
  textArea.style.outline = "none";
  textArea.style.boxShadow = "none";
  textArea.style.background = "transparent";

  document.body.appendChild(textArea);
  textArea.focus();
  textArea.select();

  try {
    const successful = document.execCommand('copy');
    const msg = successful ? 'successful' : 'unsuccessful';
    console.log('Fallback: Copying text command was ' + msg);
  } catch (err) {
    console.error('Fallback: Oops, unable to copy', err);
  }

  document.body.removeChild(textArea);
}

const currentMaxPokemonId = 10278;

//Legends ZA new megas
//https://www.serebii.net/legendsz-a/megaevolutions.shtml
const promises = $x('//*[@id="content"]//table[1]/tbody/tr[position() > 2]').map(async (x, i) => {
	const name = x.children[1].innerText.toLowerCase().replaceAll(" ", "-")
	const speciesName = name.replaceAll("mega-", "")
	const url = "https://pokeapi.co/api/v2/pokemon-species/" + speciesName
	const response = await fetch(url, {
		method: 'GET'
	})
	
	const speciesDetails = await response.json()
	const speciesId = speciesDetails.id
	
	const csvRow = i + currentMaxPokemonId + "," + name + "," + speciesId + ",height,weight,,,0"
	return csvRow
})
const resultArray = await Promise.all(promises);
const content = resultArray.join("\n")
copyTextToClipboard(content)

//Legends ZA new mega stats
const promises = $x('//*[@id="content"]//table[1]/tbody/tr[position() > 2]').map(async (x, i) => {
	const name = x.children[1].innerText.toLowerCase().replaceAll(" ", "-")
	const hp = x.children[3].innerText
	const att = x.children[4].innerText
	const def = x.children[5].innerText
	const satt = x.children[6].innerText
	const sdef = x.children[7].innerText
	const spd = x.children[8].innerText
	
	const speciesName = name.replaceAll("mega-", "")
	const url = "https://pokeapi.co/api/v2/pokemon-species/" + speciesName
	const response = await fetch(url, {
		method: 'GET'
	})
	
	const speciesDetails = await response.json()
	const speciesId = speciesDetails.id
	
	const pokemonId = i + currentMaxPokemonId
	
	const csvRow = pokemonId + ",1," + hp + ",0\n" +
		pokemonId + ",2," + att + ",0\n" +
		pokemonId + ",3," + def + ",0\n" +
		pokemonId + ",4," + satt + ",0\n" +
		pokemonId + ",5," + sdef + ",0\n" +
		pokemonId + ",6," + spd + ",0";
		
	return csvRow
})
const resultArray = await Promise.all(promises);
const content = resultArray.join("\n")
copyTextToClipboard(content)

//Legends ZA new mega types
const url = "https://pokeapi.co/api/v2/type/"
const response = await fetch(url, {
	method: 'GET'
})
const typeResult = await response.json()
const typeDictionary = typeResult.results.reduce((acc, currentObject) => {
  acc[currentObject.name] = currentObject.url.replaceAll("https://pokeapi.co/api/v2/type/", "").replaceAll("/", "");
  return acc;
}, {});

Array.from($x('//*[@id="content"]//table[1]/tbody/tr[position() > 2]')[0].children[2].children).map((y, j) => {
		const type = y.href.replaceAll("https://www.serebii.net/pokedex-sv/", "").replaceAll(".shtml", "")
		return type
	})
	
const resultArray = $x('//*[@id="content"]//table[1]/tbody/tr[position() > 2]').map((x, i) => {
	const types = Array.from(x.children[2].children)
	
	const pokemonId = i + currentMaxPokemonId
		
	return types.map((y, j) => {
		const type = y.href.replaceAll("https://www.serebii.net/pokedex-sv/", "").replaceAll(".shtml", "")
		return pokemonId + "," + typeDictionary[type] + "," + (j + 1)
	})
}).flat()
const content = resultArray.join("\n")
copyTextToClipboard(content)

//Legends ZA available pokemon
//https://www.serebii.net/legendsz-a/availablepokemon.shtml
const promises = $x('//*[@id="content"]//table[2]/tbody/tr[position() > 1]').map(async (x) => {
	const pokedexId = x.children[0].innerText.replace("#", "")
	const speciesName = x.children[2].innerText.replaceAll("é", "e")
	const url = "https://pokeapi.co/api/v2/pokemon-species/" + speciesName
	const response = await fetch(url, {
		method: 'GET'
	})
	
	const speciesDetails = await response.json()
	const speciesId = speciesDetails.id
	
	const csvRow = speciesId + ",34," + pokedexId
  
	return csvRow
})
const resultArray = await Promise.all(promises);
const content = resultArray.join("\n")
copyTextToClipboard(content)

@phalt
Copy link
Member

phalt commented Oct 17, 2025

Thanks for the incredibly thorough response, adds a lot of confidence this information is correct. Especially because you automated the larger files! I am happy to approve and ship this.

@phalt phalt merged commit ec5f292 into PokeAPI:master Oct 17, 2025
9 checks passed
@pokeapi-machine-user
Copy link

A PokeAPI/api-data refresh has started. In ~45 minutes the staging branch of PokeAPI/api-data will be pushed with the new generated data.

The staging branch will be deployed in our staging environment and the entire API will be ready to review.

A Pull Request (master<-staging) will be also created at PokeAPI/api-data and assigned to the PokeAPI Core team to be reviewed. If approved and merged new data will soon be available worldwide at pokeapi.co.

@pokeapi-machine-user
Copy link

The updater script has finished its job and has now opened a Pull Request towards PokeAPI/api-data with the updated data.

The Pull Request can be seen deployed in our staging environment when CircleCI deploy will be finished (check the start time of the last build).

Naramsim pushed a commit to PokeAPI/api-data that referenced this pull request Oct 21, 2025
@Naramsim
Copy link
Member

Naramsim commented Oct 21, 2025

Hi! I deployed in the production env, can you check if the data is present?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants