diff --git a/README.md b/README.md
index 1896041..5a287a6 100644
--- a/README.md
+++ b/README.md
@@ -10,3 +10,34 @@ View the list of FIDE players and their ratings. The source of the data is the [
- The Datasette API is available at [https://fide-players.fly.dev/players](https://fide-players.fly.dev/players)
- The HTML page is available at [https://kamicut.cc/fide-players/](https://kamicut.cc/fide-players/)
- TODO: A Github Action to update the data daily
+
+## Run locally
+
+Clone the repository and install the dependencies:
+
+```bash
+python3 -m venv venv
+source venv/bin/activate
+pip install -r requirements.txt
+```
+
+Run the script to download the data and create the database:
+
+```bash
+curl -O http://ratings.fide.com/download/players_list_xml.zip
+unzip players_list_xml.zip
+mv players_list_xml_foa.xml players.xml
+python players.py players.xml players.db
+```
+
+Run the API locally:
+
+```bash
+datasette players.db -m metadata.json
+```
+
+Open the HTML page in a browser:
+
+```bash
+open index.html
+```
diff --git a/index.html b/index.html
index 0c4b7b3..328f43b 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
+
FIDE Player Selector
@@ -75,14 +75,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
index 4c4965b..5581edd 100644
--- a/main.js
+++ b/main.js
@@ -23,7 +23,7 @@ function fideSelector() {
)
.then((response) => response.json())
.then((data) => {
- this.countries = data.rows.map((row) => row[0]).sort();
+ this.countries = data.rows.map((row) => row.country).sort();
this.initializeFromUrl();
});
},
@@ -112,6 +112,7 @@ function fideSelector() {
constructFetchUrl() {
let url = new URL("https://fide-players.fly.dev/players/players.json");
url.searchParams.append("_size", 20); // Set page size to 20
+ url.searchParams.append("_extra", "next_url");
if (this.selectedCountry) {
url.searchParams.append("country__exact", this.selectedCountry);
}
@@ -137,8 +138,8 @@ function fideSelector() {
// Select player and set the selected FIDE ID, copy to clipboard, and show toast
selectPlayer(player) {
- this.selectedFideId = player[0];
- this.copyToClipboard(player[0]);
+ this.selectedFideId = player.fideid;
+ this.copyToClipboard(player.fideid);
this.showToast();
},
diff --git a/metadata_template.json b/metadata_template.json
index 0203e82..89dc447 100644
--- a/metadata_template.json
+++ b/metadata_template.json
@@ -1,8 +1,9 @@
{
"title": "FIDE Players",
- "description": "FIDE player names, ratings, and other information. Retrieved on {{date}}",
+ "description": "FIDE player names, ratings, and other information. Retrieved on {{date}}. Created by https://keshmat.org",
"source": "FIDE Ratings list",
"source_url": "https://ratings.fide.com/download.phtml",
+ "about_url": "https://github.com/kamicut/fide-players",
"databases": {
"players": {
"tables": {