This commit is contained in:
kotama committed 2026-09-09 16:51:16 +02:00
1 parent c7f07c9e28
commit 8c690e216d
114 files changed
+4470 -1768

No files matched your search

@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray();
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
String titre = repo.getString("full_name");
String url = repo.getString("pageURL");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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, "pixabay", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()));
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,42 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("full_name");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,35 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,40 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,5 @@
package org.sillyjirafe.json;
public class ApiKeys {
}
@@ -0,0 +1,42 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName());
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
}
}
@@ -0,0 +1,14 @@
package org.sillyjirafe.json;
import java.io.File;
import org.json.JSONObject;
public class ApiKeys {
public void read()
{
File file = new File("ApiKeys.json");
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,11 @@
package org.sillyjirafe.json;
import org.json.JSONObject;
public class ApiKeys {
public void read()
{
File myObj = new File("ApiKeys.json");
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("example.txt");
try {
List<String> lines = Files.readString(filePath);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,47 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
Map<String, String> ApiKeys = new;
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,45 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class GitHubLGPLApi implements Api
{
public String getName()
{
return "GitHubLGPLApi";
}
public String getURL(int page) {
return "https://api.github.com/search/repositories?q=license:lgpl-3.0&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, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,47 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
Map<String, String> ApiKeys = new HashMap();
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,29 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
JSONObject json = new JSONObject(jsonraw);
try {
String jsonraw = Files.readString(filePath);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject(jsonraw);
}
}
@@ -0,0 +1,12 @@
package org.sillyjirafe.json;
import java.io.File;
import org.json.JSONML;
public class ApiKeys {
public void read()
{
List<String> lines = Files.readAllLines(Paths.get("filename.txt"));
}
}
@@ -0,0 +1,45 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class GitHubLGPLApi implements Api
{
public String getName()
{
return "GitHubLGPLApi";
}
public String getURL(int page) {
return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();8
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, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,5 @@
package org.sillyjirafe.json;
public class ApiKeys {
}
@@ -0,0 +1,9 @@
package org.sillyjirafe.json;
public class ApiKeys {
public void read()
{
}
}
@@ -0,0 +1,23 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
String jsonraw = Files.readString(filePath);
}
JSONObject json = new JSONObject(jsonraw);
}
}
@@ -0,0 +1,31 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("example.txt");
try {
List<String> lines = Files.readAllLines(filePath);
for (String line : lines) {
System.out.println(line);
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,31 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("");
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
String titre = repo.getString("full_name");
String url = repo.getString("pageURL");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()));
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
try {
String Jsonraw = Files.readString(filePath);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject(Jsonraw);
}
}
@@ -0,0 +1,24 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
File file = new File("ApiKeys.json");
try (Scanner Reader = new Scanner(file)) {
Reader.all
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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("pageURL");
String url = repo.getString("html_url");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,40 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject keys = items.getJSONObject(i);
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("example.txt");
try {
List<String> lines = Files.readString(filePath)
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,47 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
Map<String, String> ApiKeys = new HashMap();
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,43 @@
package org.sillyjirafe.linker;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyjirafe.db.Crawl_StateDB;
import org.sillyjirafe.db.ElementsDB;
import org.sillyjirafe.uoapi.*;
public class Main {
public static void main(String[] args) throws Exception
{
Out Out = new Out();
ElementsDB elementDB = new ElementsDB("jdbc:sqlite:elements.db");
Crawl_StateDB crawlstateDB = new Crawl_StateDB("jdbc:sqlite:crawlstates.db");
elementDB.LinkToDB();
crawlstateDB.LinkToDB();
List<String> bindNames = Out.PreOut();
Map<String, Integer> pages = new HashMap<>();
for (String nom : bindNames) {
pages.put(nom, crawlstateDB.getPage(nom));
}
List<element> elements = Out.out(pages);
for (int i = 0; i < elements.size(); i++)
{
element el = elements.get(i);
elementDB.AddEllement(el.title(), el.url(), el.licence(), el.source(), el.type());
}
for (String name : bindNames) {
crawlstateDB.updatePage(name);
}
elementDB.Close();
crawlstateDB.Close();
}
}
@@ -0,0 +1,12 @@
package org.sillyjirafe.json;
import java.io.File;
import org.json.JSONML;
public class ApiKeys {
public void read()
{
}
}
@@ -0,0 +1,45 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Map<String, String> ApiKeys = new HashMap();
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()))
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,16 @@
package org.sillyjirafe.json;
import java.io.File;
import org.json.JSONObject;
public class ApiKeys {
public void read()
{
File file = new File("ApiKeys.json");
try (Scanner myReader = new Scanner(myObj)) {
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,33 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,47 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public static Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
Map<String, String> ApiKeys = new HashMap();
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
ApiKeys.put(bind, password);
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,40 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class OpenVerseAudiosApi implements Api
{
public String getName()
{
return "OpenVerseAudiosApi";
}
public String getURL(int page, String apikey) {
return "https://api.openverse.org/v1/audio/?format=json&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results");
for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i);
String titre = image.getString("title");
String url = image.getString("url");
String licence = image.getString("license");
resultats.add(new element(titre, url, licence, "openverse", "audio"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,37 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,45 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Map<String, String> ApiKeys = new();
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
JSONArray items = json.getJSONArray("keys");
for (int i = 0; i < items.length(); i++) {
JSONObject key = items.getJSONObject(i);
String bind = key.getString("bind");
String password = key.getString("key");
}
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,25 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
File file = new File("ApiKeys.json");
try (Scanner Reader = new Scanner(file)) {
Reader.all
}
JSONObject json = new JSONObject();
}
}
@@ -0,0 +1,43 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class OpenVerseAudiosApi implements Api
{
public String getName()
{
return "OpenVerseAudiosApi";
}
public String getURL(int page, String apikey) {
return "https://api.openverse.org/v1/audio/?format=json&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results");
for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i);
String titre = image.getString("title");
String url = image.getString("url");
String licence = image.getString("license");
resultats.add(new element(titre, url, licence, "openverse", "audio"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject(jsonraw);
}
}
@@ -0,0 +1,22 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
}
}
@@ -0,0 +1,45 @@
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 GitHubMITApi implements Api
{
public String getName()
{
return "GitHubMITApi";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:mit&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, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public void read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
JSONObject json = new JSONObject(jsonraw);
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "GitHubApacheApi";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://pixabay.com/api/?page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("");
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
String titre = repo.getString("full_name");
String url = repo.getString("pageURL");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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("pageURL");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()),ApiKeys.get(Apis.get(i).getName());
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,49 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
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;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages, Map<String, String> ApiKeys) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()),ApiKeys.get(Apis.get(i).getName();
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,28 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read() throws FileNotFoundException
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
}
}
@@ -0,0 +1,33 @@
package org.sillyjirafe.json;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
public class ApiKeys {
public Map<String, String> read()
{
Path filePath = Paths.get("ApiKeys.json");
try {
String jsonraw = Files.readString(filePath);
JSONObject json = new JSONObject(jsonraw);
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
} catch (SecurityException e) {
System.err.println("Access denied: " + e.getMessage());
}
return null;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,44 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element;
public class PixabayImagesApi implements Api
{
public String getName()
{
return "PixabayImagesAPI";
}
public String getURL(int page, String apikey) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&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, "pixabay", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}