0.0.1.6
This commit is contained in:
1 parent
8c690e216d
commit
c6c7b99334
44 files changed
+2522
-1720
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,10 +20,11 @@ public class ApiKeys {
|
||||
{
|
||||
|
||||
Path filePath = Paths.get("ApiKeys.json");
|
||||
Map<String, String> ApiKeys = new HashMap();
|
||||
try {
|
||||
String jsonraw = Files.readString(filePath);
|
||||
JSONObject json = new JSONObject(jsonraw);
|
||||
Map<String, String> ApiKeys = new HashMap();
|
||||
|
||||
|
||||
JSONArray items = json.getJSONArray("keys");
|
||||
|
||||
@@ -39,6 +40,6 @@ public class ApiKeys {
|
||||
} catch (SecurityException e) {
|
||||
System.err.println("Access denied: " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
return ApiKeys;
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
|
||||
import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
|
||||
import org.sillyjirafe.uoapi.binds.GitHubMITApi;
|
||||
import org.sillyjirafe.uoapi.binds.OpenVerseAudiosApi;
|
||||
import org.sillyjirafe.uoapi.binds.OpenVerseImagesApi;
|
||||
import org.sillyjirafe.uoapi.binds.*;
|
||||
|
||||
public class Out {
|
||||
List<Api> Apis = new ArrayList<>();
|
||||
@@ -21,6 +17,7 @@ public class Out {
|
||||
Apis.add(new GitHubApacheApi());
|
||||
Apis.add(new OpenVerseImagesApi());
|
||||
Apis.add(new OpenVerseAudiosApi());
|
||||
Apis.add(new PixabayImagesApi());
|
||||
|
||||
List<String> bindnames = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ public class PixabayImagesApi implements Api
|
||||
{
|
||||
public String getName()
|
||||
{
|
||||
return "PixabayImagesAPI";
|
||||
return "PixabayImagesApi";
|
||||
}
|
||||
|
||||
public String getURL(int page, String apikey) {
|
||||
return "https://pixabay.com/api/?page=" + page + "key=" + apikey;
|
||||
return "https://pixabay.com/api/?per_page=200&page=" + page + "&key=" + apikey;
|
||||
}
|
||||
|
||||
public List<element> Parse(String jsonRaw) {
|
||||
@@ -24,14 +24,14 @@ public class PixabayImagesApi implements Api
|
||||
|
||||
try {
|
||||
JSONObject json = new JSONObject(jsonRaw);
|
||||
JSONArray items = json.getJSONArray("");
|
||||
JSONArray items = json.getJSONArray("hits");
|
||||
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
JSONObject repo = items.getJSONObject(i);
|
||||
|
||||
String titre = repo.getString("full_name");
|
||||
String titre = repo.getString("name");
|
||||
String url = repo.getString("pageURL");
|
||||
String licence = repo.getJSONObject("license").getString("spdx_id");
|
||||
String licence = "cc0";
|
||||
|
||||
resultats.add(new element(titre, url, licence, "pixabay", "image"));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user