0.0.1.4
This commit is contained in:
1 parent
c7f07c9e28
commit
8c690e216d
114 files changed
+4470
-1768
No files matched your search
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+42
@@ -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;
|
||||
}
|
||||
}
|
||||
+35
@@ -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;
|
||||
}
|
||||
}
|
||||
+40
@@ -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;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.sillyjirafe.json;
|
||||
|
||||
public class ApiKeys {
|
||||
|
||||
}
|
||||
+42
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -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();
|
||||
}
|
||||
}
|
||||
+11
@@ -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();
|
||||
}
|
||||
}
|
||||
+28
@@ -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();
|
||||
}
|
||||
}
|
||||
+47
@@ -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;
|
||||
}
|
||||
}
|
||||
+45
@@ -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;
|
||||
}
|
||||
}
|
||||
+47
@@ -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;
|
||||
}
|
||||
}
|
||||
+29
@@ -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);
|
||||
}
|
||||
}
|
||||
+12
@@ -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"));
|
||||
}
|
||||
}
|
||||
+45
@@ -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;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.sillyjirafe.json;
|
||||
|
||||
public class ApiKeys {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package org.sillyjirafe.json;
|
||||
|
||||
|
||||
public class ApiKeys {
|
||||
public void read()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+23
@@ -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);
|
||||
}
|
||||
}
|
||||
+31
@@ -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();
|
||||
}
|
||||
}
|
||||
+31
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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);
|
||||
}
|
||||
}
|
||||
+24
@@ -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();
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+40
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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();
|
||||
}
|
||||
}
|
||||
+47
@@ -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;
|
||||
}
|
||||
}
|
||||
+43
@@ -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();
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package org.sillyjirafe.json;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.json.JSONML;
|
||||
|
||||
public class ApiKeys {
|
||||
public void read()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+45
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+16
@@ -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();
|
||||
}
|
||||
}
|
||||
+33
@@ -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;
|
||||
}
|
||||
}
|
||||
+47
@@ -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;
|
||||
}
|
||||
}
|
||||
+40
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+37
@@ -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;
|
||||
}
|
||||
}
|
||||
+45
@@ -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;
|
||||
}
|
||||
}
|
||||
+25
@@ -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();
|
||||
}
|
||||
}
|
||||
+43
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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);
|
||||
}
|
||||
}
|
||||
+22
@@ -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);
|
||||
}
|
||||
}
|
||||
+45
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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);
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+49
@@ -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;
|
||||
}
|
||||
}
|
||||
+28
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
+33
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
@@ -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;
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
themeid=org.eclipse.e4.ui.css.theme.e4_dark
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
HIDE_ICONS_FOR_VIEW_TABS=false
|
||||
SHOW_DIRTY_INDICATOR_ON_TABS=false
|
||||
SHOW_FULL_TEXT_FOR_VIEW_TABS=false
|
||||
eclipse.preferences.version=1
|
||||
enableMRU=true
|
||||
themeEnabled=true
|
||||
@@ -0,0 +1,2 @@
|
||||
browsers=<?xml version\="1.0" encoding\="UTF-8"?>\n<web-browsers current\="-1"/>
|
||||
eclipse.preferences.version=1
|
||||
@@ -1,6 +1,6 @@
|
||||
IMPORT_FILES_AND_FOLDERS_RELATIVE=true
|
||||
IMPORT_FILES_AND_FOLDERS_TYPE=23,1
|
||||
eclipse.preferences.version=1
|
||||
platformState=944991997831560
|
||||
platformState=945728594589462
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
INDEX VERSION 1.134+/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.jdt.core
|
||||
263131634.index
|
||||
INDEX VERSION 1.134+/home/kotama/Silly-Jirafe/.metadata/.plugins/org.eclipse.jdt.core
|
||||
1568060524.index
|
||||
1241313270.index
|
||||
206920101.index
|
||||
4139034169.index
|
||||
4203645977.index
|
||||
1865797976.index
|
||||
206920101.index
|
||||
263131634.index
|
||||
32071656.index
|
||||
@@ -2,7 +2,7 @@
|
||||
<section name="Workbench">
|
||||
<item key="org.eclipse.jdt.ui.last.selected.jre.kind2" value="2"/>
|
||||
<item key="org.eclipse.jdt.ui.last.selected.execution.enviroment" value="JavaSE-21"/>
|
||||
<item key="org.eclipse.jdt.ui.lastextjar" value="/home/Kotama_Chio/libs"/>
|
||||
<item key="org.eclipse.jdt.ui.lastextjar" value="/home/kotama/Silly-Jirafe/libs"/>
|
||||
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
|
||||
<item key="group_libraries" value="true"/>
|
||||
<item key="layout" value="2"/>
|
||||
@@ -36,9 +36,9 @@
|
||||
<section name="NewClassCreationWizard.dialogBounds">
|
||||
<item key="DIALOG_X_ORIGIN" value="0"/>
|
||||
<item key="DIALOG_Y_ORIGIN" value="0"/>
|
||||
<item key="DIALOG_WIDTH" value="622"/>
|
||||
<item key="DIALOG_HEIGHT" value="718"/>
|
||||
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
|
||||
<item key="DIALOG_WIDTH" value="653"/>
|
||||
<item key="DIALOG_HEIGHT" value="751"/>
|
||||
<item key="DIALOG_FONT_NAME" value="1|Sans|10.0|0|GTK|1|"/>
|
||||
</section>
|
||||
<section name="OptionalMessageDialog.hide.">
|
||||
<item key="org.eclipse.jdt.ui.typecomment.deprecated" value="true"/>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<session version="1.0">
<refactoring accessors="true" comment="Delete 3 elements from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original elements:
 elements.db
 json-20250107.jar
 sqlite-jdbc-3.53.2.1.jar" description="Delete elements" element1="sqlite-jdbc-3.53.2.1.jar" element2="elements.db" element3="json-20250107.jar" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="3" stamp="1788693077363" subPackages="false" version="1.0"/>
<refactoring accessors="true" comment="Delete element from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original element: 'org.sillyjirafe.uoapi.binds.CodeBergApi.java'" description="Delete element" element1="/src<org.sillyjirafe.uoapi.binds{CodeBergApi.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788696318574" subPackages="false" version="1.0"/>
<refactoring accessors="true" comment="Delete element from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original element: 'org.sillyjirafe.uoapi.ApiKeys.java'" description="Delete element" element1="/src<org.sillyjirafe.uoapi{ApiKeys.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788701297006" subPackages="false" version="1.0"/>
|
||||
<session version="1.0">
<refactoring accessors="true" comment="Delete 3 elements from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original elements:
 elements.db
 json-20250107.jar
 sqlite-jdbc-3.53.2.1.jar" description="Delete elements" element1="sqlite-jdbc-3.53.2.1.jar" element2="elements.db" element3="json-20250107.jar" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="3" stamp="1788693077363" subPackages="false" version="1.0"/>
<refactoring accessors="true" comment="Delete element from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original element: 'org.sillyjirafe.uoapi.binds.CodeBergApi.java'" description="Delete element" element1="/src<org.sillyjirafe.uoapi.binds{CodeBergApi.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788696318574" subPackages="false" version="1.0"/>
<refactoring accessors="true" comment="Delete element from project 'SillyJirafe.org'
- Original project: 'SillyJirafe.org'
- Original element: 'org.sillyjirafe.uoapi.ApiKeys.java'" description="Delete element" element1="/src<org.sillyjirafe.uoapi{ApiKeys.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788701297006" subPackages="false" version="1.0"/>
<refactoring comment="Copy element 'GitHubApacheApi.java' to 'SillyJirafe.org/src/org.sillyjirafe.uoapi.binds'
- Original project: 'SillyJirafe.org'
- Destination element: 'SillyJirafe.org/src/org.sillyjirafe.uoapi.binds'
- Original element: 'org.sillyjirafe.uoapi.binds.GitHubApacheApi.java'" description="Copy compilation unit" destination="/src<org.sillyjirafe.uoapi.binds" element1="/src<org.sillyjirafe.uoapi.binds{GitHubApacheApi.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" policy="org.eclipse.jdt.ui.copyResources" stamp="1788964156133" units="1" version="1.0"/>
|
||||
</session>
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
1788693077363 Delete elements
|
||||
1788696318574 Delete element
|
||||
1788701297006 Delete element
|
||||
1788964156133 Copy compilation unit
|
||||
@@ -19,3 +19,10 @@
|
||||
2026-09-06 13:03:34,770 [Worker-2: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
2026-09-06 13:25:34,865 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
|
||||
2026-09-06 15:25:31,408 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
|
||||
2026-09-06 21:58:36,074 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
2026-09-07 15:26:50,258 [Worker-2: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
|
||||
2026-09-07 23:50:17,838 [Worker-1: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
2026-09-08 12:20:37,192 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
|
||||
2026-09-09 07:38:22,295 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
2026-09-09 07:38:22,392 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Updating Gradle version information cache failed. Using outdated cache.
|
||||
2026-09-09 15:38:26,321 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
Reference in new issue
Block a user