Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 379ee54580 | |||
| 965daae544 |
1
juniores_jorneys.json
Normal file
1
juniores_jorneys.json
Normal file
@@ -0,0 +1 @@
|
||||
{"14":[{"season":"2025/2026","jorneyID":2317,"numberJorney":"14","Home":22,"Away":19,"homeGoals":"11","awayGoals":"1","cup":0,"date":"2026-04-17T20:00:00.000Z","field":"Touguinha","reportURL":"/uploads/reports/33/3/2317.pdf","typeModality":"Junior"},{"season":"2025/2026","jorneyID":2319,"numberJorney":"14","Home":13,"Away":11,"homeGoals":"2","awayGoals":"8","cup":0,"date":"2026-04-19T09:00:00.000Z","field":"Arcos","reportURL":"/uploads/reports/33/3/2319.pdf","typeModality":"Junior"},{"season":"2025/2026","jorneyID":2321,"numberJorney":"14","Home":6,"Away":-1,"homeGoals":"","awayGoals":"","cup":0,"date":"1970-01-01T00:00:00.000Z","field":"Aveleda F.C.","reportURL":null,"typeModality":"Junior"},{"season":"2025/2026","jorneyID":2318,"numberJorney":"14","Home":2,"Away":12,"homeGoals":"11","awayGoals":"0","cup":0,"date":"2026-04-17T20:00:00.000Z","field":"Bagunte","reportURL":null,"typeModality":"Junior"},{"season":"2025/2026","jorneyID":2320,"numberJorney":"14","Home":23,"Away":25,"homeGoals":"7","awayGoals":"3","cup":0,"date":"2026-04-17T20:00:00.000Z","field":"Rio Mau","reportURL":"/uploads/reports/33/3/2320.pdf","typeModality":"Junior"}]}
|
||||
38
src/main/java/org/example/ApiDiscoveryCombinations.java
Normal file
38
src/main/java/org/example/ApiDiscoveryCombinations.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class ApiDiscoveryCombinations {
|
||||
public static void main(String[] args) {
|
||||
String[] paths = {
|
||||
"https://api.afavcd.pt/jorney/season/33/modality/1/discipline/teams",
|
||||
"https://api.afavcd.pt/jorney/modality/1/season/33/discipline/teams",
|
||||
"https://api.afavcd.pt/jorney/season/33/modality/1/discipline/1",
|
||||
"https://api.afavcd.pt/jorney/season/33/modality/1/discipline/1/1",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/1/jorney/1",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/teams/jorney/1",
|
||||
"https://api.afavcd.pt/standings/season/33/modality/1/discipline/1",
|
||||
"https://api.afavcd.pt/standings/season/33/modality/1/discipline/teams"
|
||||
};
|
||||
|
||||
for (String url : paths) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/main/java/org/example/ApiExplorer.java
Normal file
31
src/main/java/org/example/ApiExplorer.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class ApiExplorer {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/modalities",
|
||||
"https://api.afavcd.pt/seasons/33/modalities",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/levels"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Exploring: " + url);
|
||||
try {
|
||||
String body = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute()
|
||||
.body();
|
||||
System.out.println("Result: " + body);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/BruteForceJorneyIds.java
Normal file
34
src/main/java/org/example/BruteForceJorneyIds.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class BruteForceJorneyIds {
|
||||
public static void main(String[] args) {
|
||||
// We know 2166 is Journey 31 for Senior (Modality 1)
|
||||
// Let's test a range of IDs
|
||||
for (int id = 2130; id <= 2170; id++) {
|
||||
String url = "https://api.afavcd.pt/seasons/33/teams/modality/1/jorney?jorneyID=" + id;
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.timeout(2000)
|
||||
.execute();
|
||||
if (response.statusCode() == 200) {
|
||||
String body = response.body();
|
||||
// Check if the body contains the ID we asked for
|
||||
if (body.contains(String.valueOf(id))) {
|
||||
System.out.println("ID " + id + " is valid and returned data.");
|
||||
} else {
|
||||
// System.out.println("ID " + id + " returned journey 31 data instead.");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("ID " + id + " failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/ChampionshipExplorer.java
Normal file
34
src/main/java/org/example/ChampionshipExplorer.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class ChampionshipExplorer {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/championships",
|
||||
"https://api.afavcd.pt/seasons/33/championships",
|
||||
"https://api.afavcd.pt/championship/1/standings",
|
||||
"https://api.afavcd.pt/championship/1/jorney"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/ChampionshipJorneysTest.java
Normal file
34
src/main/java/org/example/ChampionshipJorneysTest.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class ChampionshipJorneysTest {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/championship/1/jorneys",
|
||||
"https://api.afavcd.pt/championship/1/jorneys/1",
|
||||
"https://api.afavcd.pt/championship/3/jorneys",
|
||||
"https://api.afavcd.pt/championship/1/standings"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/main/java/org/example/CheckClubKeys.java
Normal file
24
src/main/java/org/example/CheckClubKeys.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package org.example;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.jsoup.Jsoup;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CheckClubKeys {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String url = "https://api.afavcd.pt/teams";
|
||||
String json = Jsoup.connect(url).ignoreContentType(true).execute().body();
|
||||
Gson gson = new Gson();
|
||||
List<Map<String, Object>> clubs = gson.fromJson(json, new TypeToken<List<Map<String, Object>>>() {}.getType());
|
||||
if (!clubs.isEmpty()) {
|
||||
System.out.println("First club keys: " + clubs.get(0).keySet());
|
||||
System.out.println("First club data: " + clubs.get(0));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/main/java/org/example/CheckSeasons.java
Normal file
23
src/main/java/org/example/CheckSeasons.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class CheckSeasons {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://api.afavcd.pt/seasons";
|
||||
try {
|
||||
String body = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute()
|
||||
.body();
|
||||
System.out.println("Seasons JSON: " + body);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/DisciplineJorneyDiscovery.java
Normal file
34
src/main/java/org/example/DisciplineJorneyDiscovery.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class DisciplineJorneyDiscovery {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/jorney/season/33/modality/1/discipline/1",
|
||||
"https://api.afavcd.pt/jorney/season/33/modality/3/discipline/1",
|
||||
"https://api.afavcd.pt/standings/season/33/modality/1/discipline/1",
|
||||
"https://api.afavcd.pt/standings/season/33/modality/3/discipline/1"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/main/java/org/example/DisciplineSearch.java
Normal file
33
src/main/java/org/example/DisciplineSearch.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class DisciplineSearch {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/disciplines",
|
||||
"https://api.afavcd.pt/seasons/33/disciplines",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/disciplines"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Result: " + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/main/java/org/example/ExhaustiveApiSearch.java
Normal file
43
src/main/java/org/example/ExhaustiveApiSearch.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class ExhaustiveApiSearch {
|
||||
public static void main(String[] args) {
|
||||
String base = "https://api.afavcd.pt/seasons/33";
|
||||
String[] paths = {
|
||||
"/modality/1/standings",
|
||||
"/modality/1/discipline/1/standings",
|
||||
"/modality/1/level/1/discipline/1/standings",
|
||||
"/teams/modality/1/standings",
|
||||
"/teams/modality/1/discipline/1/standings",
|
||||
"/teams/modality/1/jorney?jorney=1",
|
||||
"/teams/modality/1/jorney?number=1",
|
||||
"/teams/modality/1/jorney?id=1",
|
||||
"/teams/modality/1/jorney/all",
|
||||
"/teams/modality/1/games",
|
||||
"/teams/modality/1/all-games"
|
||||
};
|
||||
|
||||
for (String path : paths) {
|
||||
String url = base + path;
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 2) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/FinalApiDiscovery.java
Normal file
34
src/main/java/org/example/FinalApiDiscovery.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class FinalApiDiscovery {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/jorney/modality/1/season/33",
|
||||
"https://api.afavcd.pt/jorney/active/modality/1/season/33",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/jorney",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/1/jorney"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 500)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/main/java/org/example/FindChampionships.java
Normal file
33
src/main/java/org/example/FindChampionships.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class FindChampionships {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/campeonatos",
|
||||
"https://api.afavcd.pt/teams/modality/1/season/33/discipline/teams",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/1/jorney"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 500)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/FindLatestSeason.java
Normal file
34
src/main/java/org/example/FindLatestSeason.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class FindLatestSeason {
|
||||
public static void main(String[] args) {
|
||||
for (int i = 30; i < 40; i++) {
|
||||
String url = "https://api.afavcd.pt/seasons/" + i + "/teams/modality/1/discipline/teams";
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
|
||||
if (response.statusCode() == 200) {
|
||||
String body = response.body();
|
||||
if (body.length() > 20) { // Some results found
|
||||
System.out.println("Season " + i + " exists. Length: " + body.length());
|
||||
} else {
|
||||
System.out.println("Season " + i + " returns empty array.");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Season " + i + " returned status: " + response.statusCode());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Season " + i + " failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/main/java/org/example/InspectJornadas.java
Normal file
31
src/main/java/org/example/InspectJornadas.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class InspectJornadas {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/1/jorney",
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/3/jorney"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Inspecting: " + url);
|
||||
try {
|
||||
String body = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute()
|
||||
.body();
|
||||
System.out.println("Result length: " + body.length());
|
||||
System.out.println("Start of result: " + body.substring(0, Math.min(body.length(), 500)));
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
src/main/java/org/example/JorneyIdParamTest.java
Normal file
36
src/main/java/org/example/JorneyIdParamTest.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class JorneyIdParamTest {
|
||||
public static void main(String[] args) {
|
||||
String base = "https://api.afavcd.pt/seasons/33/teams/modality/1/jorney";
|
||||
String[] urls = {
|
||||
base + "?jorneyID=2166",
|
||||
base + "?jorneyID=2165",
|
||||
base + "?jorneyID=2164",
|
||||
base + "?jorney=30",
|
||||
base + "?jorney=1"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/JorneyListDiscovery.java
Normal file
34
src/main/java/org/example/JorneyListDiscovery.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class JorneyListDiscovery {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/jorneys/season/33/modality/1/discipline/1",
|
||||
"https://api.afavcd.pt/jorneys/active/modality/1/season/33",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/1/jorney",
|
||||
"https://api.afavcd.pt/jorney/active/modality/1/discipline/1/season/33"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Result: " + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,9 +92,9 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Obter escalões
|
||||
int[] idsEscaloes = { 1, 3, 2 };
|
||||
String[] nomesEscaloes = { "seniores", "juniores", "feminino" };
|
||||
// 2. Obter escalões (Apenas Seniores e Juniores conforme pedido)
|
||||
int[] idsEscaloes = { 1, 3 };
|
||||
String[] nomesEscaloes = { "seniores", "juniores" };
|
||||
|
||||
for (int i = 0; i < idsEscaloes.length; i++) {
|
||||
int idAtual = idsEscaloes[i];
|
||||
@@ -166,10 +166,12 @@ public class Main {
|
||||
foto = (String) atleta.get("photoURl");
|
||||
}
|
||||
|
||||
if (foto != null && !foto.startsWith("http")) {
|
||||
foto = "https://api.afavcd.pt" + foto;
|
||||
if (foto != null && !foto.trim().isEmpty() && !foto.equalsIgnoreCase("null")) {
|
||||
if (!foto.startsWith("http")) {
|
||||
foto = "https://api.afavcd.pt" + foto;
|
||||
}
|
||||
p.setPhotoUrl(foto);
|
||||
}
|
||||
p.setPhotoUrl(foto);
|
||||
|
||||
if (atleta.get("birth") != null) {
|
||||
String date = (String) atleta.get("birth");
|
||||
@@ -190,7 +192,7 @@ public class Main {
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Erro ao processar jogadores do clube ID: " + clubId);
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
src/main/java/org/example/SeasonDetailTest.java
Normal file
26
src/main/java/org/example/SeasonDetailTest.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class SeasonDetailTest {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://api.afavcd.pt/seasons/33";
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/SeasonGamesTest.java
Normal file
34
src/main/java/org/example/SeasonGamesTest.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class SeasonGamesTest {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/games/season/33/modality/1",
|
||||
"https://api.afavcd.pt/games/modality/1/season/33",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/games",
|
||||
"https://api.afavcd.pt/jorneys/season/33/modality/1"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.example.models.Club;
|
||||
import org.example.models.GameMatch;
|
||||
import org.example.models.TeamStanding;
|
||||
import org.jsoup.Connection;
|
||||
import org.jsoup.Jsoup;
|
||||
@@ -58,14 +59,29 @@ public class StandingsScraper {
|
||||
}.getType());
|
||||
|
||||
for (Map<String, Object> c : dadosClubes) {
|
||||
if (c.get("teamID") != null) {
|
||||
int clubId = (int) Double.parseDouble(c.get("teamID").toString());
|
||||
Object teamIdObj = c.get("teamID");
|
||||
if (teamIdObj == null) teamIdObj = c.get("teamId"); // Fallback para lowercase 'd'
|
||||
|
||||
if (teamIdObj != null) {
|
||||
int clubId = (int) Double.parseDouble(teamIdObj.toString());
|
||||
Club club = new Club();
|
||||
club.setId(clubId);
|
||||
if (c.get("name") != null)
|
||||
club.setName(c.get("name").toString());
|
||||
if (c.get("logoURL") != null)
|
||||
club.setImageUrl(c.get("logoURL").toString());
|
||||
|
||||
// Nomes alternativos
|
||||
Object name = c.get("name");
|
||||
if (name == null) name = c.get("fullName");
|
||||
if (name == null) name = c.get("nome");
|
||||
|
||||
if (name != null)
|
||||
club.setName(name.toString());
|
||||
|
||||
// Logo alternativos
|
||||
Object logo = c.get("logoURL");
|
||||
if (logo == null) logo = c.get("logoUrl");
|
||||
if (logo == null) logo = c.get("imagem");
|
||||
|
||||
if (logo != null)
|
||||
club.setImageUrl(logo.toString());
|
||||
|
||||
clubesMap.put(clubId, club);
|
||||
}
|
||||
@@ -99,44 +115,105 @@ public class StandingsScraper {
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
Map<String, List<Map<String, Object>>> matchdays = gson.fromJson(jsonJornadas,
|
||||
Map<String, List<Map<String, Object>>> matchdaysMap = gson.fromJson(jsonJornadas,
|
||||
new TypeToken<Map<String, List<Map<String, Object>>>>() {
|
||||
}.getType());
|
||||
|
||||
Map<Integer, TeamStanding> standingsMap = new HashMap<>();
|
||||
Map<String, List<GameMatch>> jornadasParaFirebase = new LinkedHashMap<>();
|
||||
|
||||
for (Map.Entry<String, List<Map<String, Object>>> entry : matchdaysMap.entrySet()) {
|
||||
String nomeJornada = entry.getKey();
|
||||
List<Map<String, Object>> matchday = entry.getValue();
|
||||
List<GameMatch> matchesInJornada = new ArrayList<>();
|
||||
|
||||
for (List<Map<String, Object>> matchday : matchdays.values()) {
|
||||
for (Map<String, Object> match : matchday) {
|
||||
try {
|
||||
int homeTeamId = parseId(match.get("Home"));
|
||||
int awayTeamId = parseId(match.get("Away"));
|
||||
|
||||
// Ignorar jogos com equipas placeholder / de descanso
|
||||
// Ignorar jogos com equipas placeholder / de descanso para a classificação
|
||||
// Mas guardamos para as jornadas (podes decidir se queres filtrar ou não)
|
||||
if (homeTeamId < 0 || awayTeamId < 0)
|
||||
continue;
|
||||
|
||||
String homeGoalsStr = String.valueOf(match.get("homeGoals"));
|
||||
String awayGoalsStr = String.valueOf(match.get("awayGoals"));
|
||||
// Modelar o jogo para as Jornadas
|
||||
GameMatch game = new GameMatch();
|
||||
game.setHomeId(homeTeamId);
|
||||
game.setAwayId(awayTeamId);
|
||||
// Buscar dados dos clubes no mapa local para garantir nome e logo
|
||||
Club homeClub = clubesMap.get(homeTeamId);
|
||||
Club awayClub = clubesMap.get(awayTeamId);
|
||||
|
||||
game.setHomeName(homeClub != null ? homeClub.getName() : "Equipa " + homeTeamId);
|
||||
game.setAwayName(awayClub != null ? awayClub.getName() : "Equipa " + awayTeamId);
|
||||
game.setHomeLogo(homeClub != null ? homeClub.getImageUrl() : "");
|
||||
game.setAwayLogo(awayClub != null ? awayClub.getImageUrl() : "");
|
||||
|
||||
// Tratar Data e Hora
|
||||
Object dateObj = match.get("date");
|
||||
if (dateObj == null) dateObj = match.get("Date");
|
||||
|
||||
String rawDate = dateObj != null ? dateObj.toString() : "";
|
||||
if (!rawDate.isEmpty() && rawDate.contains("T")) {
|
||||
String[] parts = rawDate.split("T");
|
||||
game.setGameDate(parts[0]); // yyyy-MM-dd
|
||||
if (parts[1].length() >= 5) {
|
||||
game.setGameHour(parts[1].substring(0, 5)); // HH:mm
|
||||
}
|
||||
} else {
|
||||
game.setGameDate(rawDate);
|
||||
game.setGameHour("");
|
||||
}
|
||||
|
||||
Object fieldObj = match.get("field");
|
||||
if (fieldObj == null) fieldObj = match.get("Field");
|
||||
if (fieldObj == null) fieldObj = match.get("campo");
|
||||
|
||||
game.setStadium(fieldObj != null ? fieldObj.toString() : "");
|
||||
|
||||
Object reportObj = match.get("reportURL");
|
||||
if (reportObj == null) reportObj = match.get("reportUrl");
|
||||
|
||||
game.setReportUrl(reportObj != null ? reportObj.toString() : "");
|
||||
|
||||
Object hG = match.get("homeGoals");
|
||||
if (hG == null) hG = match.get("home_golos");
|
||||
Object aG = match.get("awayGoals");
|
||||
if (aG == null) aG = match.get("away_golos");
|
||||
|
||||
String homeGoalsStr = hG != null ? String.valueOf(hG) : null;
|
||||
String awayGoalsStr = aG != null ? String.valueOf(aG) : null;
|
||||
|
||||
if (homeGoalsStr != null && !homeGoalsStr.trim().isEmpty()
|
||||
&& !homeGoalsStr.equals("null")) {
|
||||
int homeGoals = (int) Double.parseDouble(homeGoalsStr);
|
||||
int awayGoals = (int) Double.parseDouble(awayGoalsStr);
|
||||
|
||||
// Inicializar as equipas caso não existam no standingsMap
|
||||
game.setHomeGoals(homeGoals);
|
||||
game.setAwayGoals(awayGoals);
|
||||
|
||||
// Atualizar classificação
|
||||
standingsMap.putIfAbsent(homeTeamId, createInitialStanding(homeTeamId, clubesMap));
|
||||
standingsMap.putIfAbsent(awayTeamId, createInitialStanding(awayTeamId, clubesMap));
|
||||
|
||||
standingsMap.get(homeTeamId).addMatchResult(homeGoals, awayGoals);
|
||||
standingsMap.get(awayTeamId).addMatchResult(awayGoals, homeGoals);
|
||||
} else {
|
||||
game.setHomeGoals(null);
|
||||
game.setAwayGoals(null);
|
||||
}
|
||||
|
||||
matchesInJornada.add(game);
|
||||
|
||||
} catch (Exception ex) {
|
||||
// Ignorar erro em um jogo específico (dados incorretos, etc)
|
||||
}
|
||||
}
|
||||
jornadasParaFirebase.put(nomeJornada, matchesInJornada);
|
||||
}
|
||||
|
||||
// Transformar em lista e ordenar
|
||||
// Transformar em lista e ordenar a classificação
|
||||
List<TeamStanding> sortedStandings = new ArrayList<>(standingsMap.values());
|
||||
Collections.sort(sortedStandings);
|
||||
|
||||
@@ -150,19 +227,27 @@ public class StandingsScraper {
|
||||
posicao++;
|
||||
}
|
||||
|
||||
// Enviar para Firebase
|
||||
// Enviar para Firebase - CLASSIFICAÇÕES
|
||||
DatabaseReference refClassificacoes = FirebaseDatabase.getInstance()
|
||||
.getReference("classificacoes").child(escalao);
|
||||
|
||||
refClassificacoes.setValueAsync(sortedStandings);
|
||||
System.out.println("-> Classificação de " + escalao + " enviada para o Firebase.");
|
||||
|
||||
// Enviar para Firebase - JORNADAS
|
||||
DatabaseReference refJornadas = FirebaseDatabase.getInstance()
|
||||
.getReference("jornadas").child(escalao);
|
||||
|
||||
refJornadas.setValueAsync(jornadasParaFirebase);
|
||||
System.out.println("-> Jornadas de " + escalao + " enviadas para o Firebase (" + jornadasParaFirebase.size() + " jornadas).");
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Erro a processar " + escalao);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
System.out.println("\nAguardando confirmação do servidor (5s)...");
|
||||
Thread.sleep(5000);
|
||||
|
||||
23
src/main/java/org/example/TestApiSingular.java
Normal file
23
src/main/java/org/example/TestApiSingular.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestApiSingular {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://api.afavcd.pt/seasons/33/teams/modality/3/jorney";
|
||||
try {
|
||||
String body = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute()
|
||||
.body();
|
||||
System.out.println(body.substring(0, Math.min(body.length(), 2000)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/main/java/org/example/TestAthleteHeaders.java
Normal file
28
src/main/java/org/example/TestAthleteHeaders.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestAthleteHeaders {
|
||||
public static void main(String[] args) {
|
||||
// Try club 1, modality 1, season 33
|
||||
String url = "https://api.afavcd.pt/teams/1/modality/1/season/33";
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 500)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/main/java/org/example/TestAthleteJson.java
Normal file
26
src/main/java/org/example/TestAthleteJson.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestAthleteJson {
|
||||
public static void main(String[] args) {
|
||||
// Club ID 1 (Arvore) and Modality 1 (Senior)
|
||||
String url = "https://api.afavcd.pt/teams/1/modality/1/season/33";
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 2000)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/main/java/org/example/TestClubGames.java
Normal file
33
src/main/java/org/example/TestClubGames.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestClubGames {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/teams/16/modality/1/season/33/games",
|
||||
"https://api.afavcd.pt/teams/16/modality/1/season/33/jorney",
|
||||
"https://api.afavcd.pt/games/modality/1/season/33"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/TestJornadaEndpoint.java
Normal file
34
src/main/java/org/example/TestJornadaEndpoint.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestJornadaEndpoint {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/1/jorney/1",
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/1/jorney/2",
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/1/jornadas",
|
||||
"https://api.afavcd.pt/seasons/33/teams/modality/1/games"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/main/java/org/example/TestJorneyId.java
Normal file
35
src/main/java/org/example/TestJorneyId.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestJorneyId {
|
||||
public static void main(String[] args) {
|
||||
// Try to fetch a specific journey by its ID
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/jorney/2166",
|
||||
"https://api.afavcd.pt/jorney/2165",
|
||||
"https://api.afavcd.pt/jorney/2164",
|
||||
"https://api.afavcd.pt/seasons/33/jorneys"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/main/java/org/example/TestJorneysPlural.java
Normal file
26
src/main/java/org/example/TestJorneysPlural.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestJorneysPlural {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://api.afavcd.pt/seasons/33/teams/modality/1/jorneys";
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 1000)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/main/java/org/example/TestNewEndpoint.java
Normal file
26
src/main/java/org/example/TestNewEndpoint.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestNewEndpoint {
|
||||
public static void main(String[] args) {
|
||||
String url = "https://api.afavcd.pt/seasons/33/teams/modality/1";
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200) {
|
||||
System.out.println("Result: " + response.body().substring(0, Math.min(response.body().length(), 500)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/example/TestNewJornadaEndpoint.java
Normal file
34
src/main/java/org/example/TestNewJornadaEndpoint.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.Connection;
|
||||
|
||||
public class TestNewJornadaEndpoint {
|
||||
public static void main(String[] args) {
|
||||
String[] urls = {
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/jorney",
|
||||
"https://api.afavcd.pt/seasons/33/modality/3/jorney",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/discipline/1/jorney",
|
||||
"https://api.afavcd.pt/seasons/33/modality/1/level/1/discipline/1/jorney"
|
||||
};
|
||||
|
||||
for (String url : urls) {
|
||||
System.out.println("Testing: " + url);
|
||||
try {
|
||||
Connection.Response response = Jsoup.connect(url)
|
||||
.ignoreContentType(true)
|
||||
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
|
||||
.header("Referer", "https://www.afavcd.pt/")
|
||||
.header("Origin", "https://www.afavcd.pt")
|
||||
.method(Connection.Method.GET)
|
||||
.execute();
|
||||
System.out.println("Status: " + response.statusCode() + " Length: " + response.body().length());
|
||||
if (response.statusCode() == 200 && response.body().length() > 0) {
|
||||
System.out.println("Preview: " + response.body().substring(0, Math.min(response.body().length(), 200)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
165
src/main/java/org/example/models/GameMatch.java
Normal file
165
src/main/java/org/example/models/GameMatch.java
Normal file
@@ -0,0 +1,165 @@
|
||||
package org.example.models;
|
||||
|
||||
import com.google.firebase.database.PropertyName;
|
||||
|
||||
public class GameMatch {
|
||||
|
||||
@PropertyName("home_id")
|
||||
private int homeId;
|
||||
|
||||
@PropertyName("away_id")
|
||||
private int awayId;
|
||||
|
||||
@PropertyName("home_nome")
|
||||
private String homeName;
|
||||
|
||||
@PropertyName("away_nome")
|
||||
private String awayName;
|
||||
|
||||
@PropertyName("home_logo")
|
||||
private String homeLogo;
|
||||
|
||||
@PropertyName("away_logo")
|
||||
private String awayLogo;
|
||||
|
||||
@PropertyName("home_golos")
|
||||
private Integer homeGoals;
|
||||
|
||||
@PropertyName("away_golos")
|
||||
private Integer awayGoals;
|
||||
|
||||
@PropertyName("data")
|
||||
private String gameDate;
|
||||
|
||||
@PropertyName("hora")
|
||||
private String gameHour;
|
||||
|
||||
@PropertyName("campo")
|
||||
private String stadium;
|
||||
|
||||
@PropertyName("report_url")
|
||||
private String reportUrl;
|
||||
|
||||
public GameMatch() {
|
||||
}
|
||||
|
||||
@PropertyName("home_id")
|
||||
public int getHomeId() {
|
||||
return homeId;
|
||||
}
|
||||
|
||||
@PropertyName("home_id")
|
||||
public void setHomeId(int homeId) {
|
||||
this.homeId = homeId;
|
||||
}
|
||||
|
||||
@PropertyName("away_id")
|
||||
public int getAwayId() {
|
||||
return awayId;
|
||||
}
|
||||
|
||||
@PropertyName("away_id")
|
||||
public void setAwayId(int awayId) {
|
||||
this.awayId = awayId;
|
||||
}
|
||||
|
||||
@PropertyName("home_nome")
|
||||
public String getHomeName() {
|
||||
return homeName;
|
||||
}
|
||||
|
||||
@PropertyName("home_nome")
|
||||
public void setHomeName(String homeName) {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("away_nome")
|
||||
public String getAwayName() {
|
||||
return awayName;
|
||||
}
|
||||
|
||||
@PropertyName("away_nome")
|
||||
public void setAwayName(String awayName) {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("home_logo")
|
||||
public String getHomeLogo() {
|
||||
return homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("home_logo")
|
||||
public void setHomeLogo(String homeLogo) {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("away_logo")
|
||||
public String getAwayLogo() {
|
||||
return awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("away_logo")
|
||||
public void setAwayLogo(String awayLogo) {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("home_golos")
|
||||
public Integer getHomeGoals() {
|
||||
return homeGoals;
|
||||
}
|
||||
|
||||
@PropertyName("home_golos")
|
||||
public void setHomeGoals(Integer homeGoals) {
|
||||
this.homeGoals = homeGoals;
|
||||
}
|
||||
|
||||
@PropertyName("away_golos")
|
||||
public Integer getAwayGoals() {
|
||||
return awayGoals;
|
||||
}
|
||||
|
||||
@PropertyName("away_golos")
|
||||
public void setAwayGoals(Integer awayGoals) {
|
||||
this.awayGoals = awayGoals;
|
||||
}
|
||||
|
||||
@PropertyName("data")
|
||||
public String getGameDate() {
|
||||
return gameDate;
|
||||
}
|
||||
|
||||
@PropertyName("data")
|
||||
public void setGameDate(String gameDate) {
|
||||
this.gameDate = gameDate;
|
||||
}
|
||||
|
||||
@PropertyName("hora")
|
||||
public String getGameHour() {
|
||||
return gameHour;
|
||||
}
|
||||
|
||||
@PropertyName("hora")
|
||||
public void setGameHour(String gameHour) {
|
||||
this.gameHour = gameHour;
|
||||
}
|
||||
|
||||
@PropertyName("campo")
|
||||
public String getStadium() {
|
||||
return stadium;
|
||||
}
|
||||
|
||||
@PropertyName("campo")
|
||||
public void setStadium(String stadium) {
|
||||
this.stadium = stadium;
|
||||
}
|
||||
|
||||
@PropertyName("report_url")
|
||||
public String getReportUrl() {
|
||||
return reportUrl;
|
||||
}
|
||||
|
||||
@PropertyName("report_url")
|
||||
public void setReportUrl(String reportUrl) {
|
||||
this.reportUrl = reportUrl;
|
||||
}
|
||||
}
|
||||
1
teams.json
Normal file
1
teams.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user