diff --git a/resources/update-words-cpp.py b/resources/update-words-cpp.py old mode 100644 new mode 100755 index e0ba5c1..47d9849 --- a/resources/update-words-cpp.py +++ b/resources/update-words-cpp.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from argparse import ArgumentParser, FileType -from datetime import datetime, timezone from requests import get from bs4 import BeautifulSoup @@ -24,14 +23,14 @@ def update_words(output): choices = json.loads("[" + re.findall(r'"cigar"(?:,"\w{5}")*\]', js)[0]) # Then grab the known word order - words = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000").json() + words = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000&include=id").json() # Now let's make the file, first inclues output.write('#include "words.hpp"\n\n') # Then the known word order output.write("std::vector Words::order = {") - output.write(", ".join([word["id"] for word in words])) + output.write(", ".join([str(word) for word in words])) output.write("};\n\n") # The choice words diff --git a/resources/update-words.py b/resources/update-words.py index cb5c43f..0c9322a 100755 --- a/resources/update-words.py +++ b/resources/update-words.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 -from argparse import ArgumentParser, FileType -from datetime import datetime, timezone +from argparse import ArgumentParser from requests import get from os import path import json -import re def update_words(mod_json): @@ -21,7 +19,7 @@ def update_words(mod_json): # Ensure the structure exists if "words" not in j: - j["words"] = {} + j["words"] = {} # Get all of the known word order j["words"]["order"] = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000&include=id").json()