fix top rated and trending

This commit is contained in:
J62 2025-03-16 00:07:23 -07:00
parent 1c1066d399
commit ceceb4dd6e
1 changed files with 18 additions and 8 deletions

View File

@ -51,8 +51,10 @@ public class ChaturbateTabProvider extends AbstractTabProvider {
followedTab.setImageAspectRatio(9.0 / 16.0);
tabs.add(followedTab);
tabs.add(createApiTab("Top Rated", buildUrl("/discover/carousels/top-rated/")));
tabs.add(createApiTab("Trending", buildUrl("/discover/carousels/trending/")));
//tabs.add(createApiTab("Top Rated", buildUrl("/discover/carousels/top-rated/")));
//tabs.add(createApiTab("Trending", buildUrl("/discover/carousels/trending/")));
tabs.add(createApiTab("Top Rated", apiUrl + "/discover/carousels/top-rated/"));
tabs.add(createApiTab("Trending", apiUrl + "/discover/carousels/trending/"));
return tabs;
}
@ -82,14 +84,22 @@ public class ChaturbateTabProvider extends AbstractTabProvider {
private String buildUrl(String endpoint) {
boolean filterNA = Config.getInstance().getSettings().filterNAcamsOnly; // Always check latest setting
// Ensure that certain tabs remain unchanged
if (endpoint.contains("&regions=NA") || endpoint.contains("&hidden=true") || endpoint.contains("&gaming=true")) {
return apiUrl + endpoint; // Do NOT modify these URLs
// Do NOT modify "N.American Cams" - it should always have &regions=NA
if (endpoint.contains("&regions=NA")) {
return apiUrl + endpoint; // Keep it unchanged
}
// Apply &regions=NA dynamically to other endpoints based on the checkbox setting
String url = apiUrl + endpoint + (filterNA ? "&regions=NA" : "");
System.out.println("Building URL: " + url); // Debugging line
// Ensure Top Rated & Trending use ? instead of &
if (filterNA && endpoint.contains("discover/carousels")) {
endpoint += "?regions=NA"; // Use ? instead of &
}
// For all other tabs (except N.American Cams), append &regions=NA if enabled
else if (filterNA) {
endpoint += "&regions=NA";
}
String url = apiUrl + endpoint;
System.out.println("Building URL: " + url); // Debugging output
return url;
}