How to create list of countries with certain characteristics in a dictionary

Basically, I want to make a dictionary, each dictionary for a certain characteristic, and all 195 countries’ value on that. For example:

local Hemisphere = {
["Netherlands"] = "North"
... for all 195 countries
}

How would I get this info, do I have to copy paste them all manually? I don’t know where I could find a CSV file or even how to convert it. On this page, it has a list of countries, but no way to download the file: Southern Hemisphere - Wikipedia

Well, the only thing I can think of for this would be web scraping, which would be in javascript. You would have to figure it out yourself as web scraping takes a lot of time and can be annoying. You should use crawlee for web scraping.

1 Like

You can web scrap in almost any language

1 Like

I’ve found this csv which has coördinates, country codes and country names of 241 countries?

How would I convert it into a dictionary though?

Thank you, I will look into this, but is there a web scrapper for lua?

Something like this

local data = [["AD","Andorra",42.5,1.5
"AE","United Arab Emirates",24,54
"AF","Afghanistan",33,65
"AG","Antigua and Barbuda",17.05,-61.8]] -- only first 4 for the example

local countries = {}
local rows = data:split("\n")

for _,row in rows do
	local items = row:split(",")
	
	local code = items[1]:sub(2, items[1]:len()-1) -- sub the "" away
	local name = items[2]:sub(2, items[2]:len()-1)
	local latitude = tonumber(items[3])
	local longitude = tonumber(items[4])
	
	countries[code] = { -- you can switch name and code if you prefer
		name = name,
		latitude = latitude,
		longitude = longitude
	}
end

print(countries)

image