This commit is contained in:
Celeste Madeline Samuel Nokto Dur Grossiord
2026-09-06 14:08:48 +02:00
parent 55add0db6a
commit 18a02484a4
39 changed files with 2065 additions and 1724 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyjirafe.uoapi.binds.CodeBergApi;
import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
import org.sillyjirafe.uoapi.binds.GitHubMITApi;
@@ -22,7 +21,6 @@ public class Out {
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
Apis.add(new CodeBergApi());
List<String> bindnames = new ArrayList<>();
@@ -1,45 +0,0 @@
package org.sillyjirafe.uoapi.binds;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
import java.util.ArrayList;
import java.util.List;
public class CodeBergApi implements Api
{
public String getName()
{
return "CadeBergApi";
}
public String getURL(int page) {
return "https://codeberg.org/api/v1/repos/search?page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("items");
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
String titre = repo.getString("full_name");
String url = repo.getString("html_url");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "codeberg", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}