This commit is contained in:
choelzl 2022-02-09 03:16:02 +01:00
parent f66eb64998
commit 4c91662ec8
Signed by: sora
GPG Key ID: A362EA0491E2EEA0

View File

@ -4,8 +4,11 @@
function fetchSeed(id) { function fetchSeed(id) {
var HttpRequest = Packages.com.gmt2001.HttpRequest, var HttpRequest = Packages.com.gmt2001.HttpRequest,
JSONObject = Packages.org.json.JSONObject; HashMap = Packages.java.util.HashMap,
let request = HttpRequest.getData(HttpRequest.RequestType.GET,`https://www.geoguessr.com/api/v3/games/${id}`,{},{}); JSONObject = Packages.org.json.JSONObject
header = new HashMap(0),
json = new JSONObject('{}');
let request = HttpRequest.getData(HttpRequest.RequestType.GET,`https://www.geoguessr.com/api/v3/games/${id}`,json.toString(),header);
if (request.success) { if (request.success) {
var data = new JSONObject(request.content) var data = new JSONObject(request.content)
return data; return data;
@ -13,14 +16,16 @@
}; };
function getCountryBDC(location) { function getCountryBDC(location) {
var HttpRequest = Packages.com.gmt2001.HttpRequest, var HttpRequest = Packages.com.gmt2001.HttpRequest,
JSONObject = Packages.org.json.JSONObject; HashMap = Packages.java.util.HashMap,
JSONObject = Packages.org.json.JSONObject
header = new HashMap(0),
json = new JSONObject('{}');
const BDC_KEY = "067c718d2bbd4a2ba8d0645e1633cac2"; const BDC_KEY = "067c718d2bbd4a2ba8d0645e1633cac2";
let request = HttpRequest.getData(HttpRequest.RequestType.GET,`https://api.bigdatacloud.net/data/reverse-geocode?latitude=${location.lat}&longitude=${location.lng}&key=${BDC_KEY}`,{},{}); let request = HttpRequest.getData(HttpRequest.RequestType.GET,`https://api.bigdatacloud.net/data/reverse-geocode?latitude=${location.lat}&longitude=${location.lng}&key=${BDC_KEY}`,json.toString(),header);
if (request.success) { if (request.success) {
var data = new JSONObject(request.content) var data = new JSONObject(request.content)
return data.countryCode; return data.countryCode;
} }
}; };
function getSurroundings (location) { function getSurroundings (location) {
const meters = 100; const meters = 100;