1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-15 02:14:10 +02:00

Fix logger for rgif ripper

This commit is contained in:
Tush-r
2024-08-29 17:21:01 +05:30
committed by soloturn
parent 8c455e7ec1
commit a7cb78eceb

View File

@@ -4,8 +4,6 @@ import com.rarchives.ripme.utils.Http;
import org.json.JSONObject; import org.json.JSONObject;
import static com.rarchives.ripme.App.logger;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
@@ -149,7 +147,7 @@ public class RedgifsRipper extends AbstractJSONRipper {
sText = URLDecoder.decode(sText, StandardCharsets.UTF_8); sText = URLDecoder.decode(sText, StandardCharsets.UTF_8);
var list = Arrays.asList(sText.split(",")); var list = Arrays.asList(sText.split(","));
if (list.size() > 1) { if (list.size() > 1) {
logger.warn("Url with multiple tags found. \nThey will be sorted alphabetically for folder name."); LOGGER.warn("Url with multiple tags found. \nThey will be sorted alphabetically for folder name.");
} }
Collections.sort(list); Collections.sort(list);
var gid = list.stream().reduce("", (acc, val) -> acc.concat("_" + val)); var gid = list.stream().reduce("", (acc, val) -> acc.concat("_" + val));
@@ -242,7 +240,7 @@ public class RedgifsRipper extends AbstractJSONRipper {
list.add(hdURL); list.add(hdURL);
} }
} catch (IOException e) { } catch (IOException e) {
logger.error(String.format("Error fetching gallery %s for gif %s", galleryID, gifID), e); LOGGER.error(String.format("Error fetching gallery %s for gif %s", galleryID, gifID), e);
} }
return list; return list;
} }
@@ -305,7 +303,7 @@ public class RedgifsRipper extends AbstractJSONRipper {
switch (value) { switch (value) {
case "gifs" -> endpointQueryParams.put("type", "g"); case "gifs" -> endpointQueryParams.put("type", "g");
case "images" -> endpointQueryParams.put("type", "i"); case "images" -> endpointQueryParams.put("type", "i");
default -> logger.warn(String.format("Unsupported tab for tags url %s", value)); default -> LOGGER.warn(String.format("Unsupported tab for tags url %s", value));
} }
break; break;
case "verified": case "verified":
@@ -323,7 +321,7 @@ public class RedgifsRipper extends AbstractJSONRipper {
case "viewMode": case "viewMode":
break; break;
default: default:
logger.warn(String.format("Unexpected query param %s for search url. Skipping.", name)); LOGGER.warn(String.format("Unexpected query param %s for search url. Skipping.", name));
} }
} }
@@ -337,7 +335,7 @@ public class RedgifsRipper extends AbstractJSONRipper {
} }
// Check if it is the main tags page with all gifs, images, creator etc // Check if it is the main tags page with all gifs, images, creator etc
if (!endpointQueryParams.containsKey("type")) { if (!endpointQueryParams.containsKey("type")) {
logger.warn("No tab selected, defaulting to gifs"); LOGGER.warn("No tab selected, defaulting to gifs");
endpointQueryParams.put("type", "g"); endpointQueryParams.put("type", "g");
} }
uri = new URIBuilder(TAGS_ENDPOINT); uri = new URIBuilder(TAGS_ENDPOINT);
@@ -348,8 +346,8 @@ public class RedgifsRipper extends AbstractJSONRipper {
switch (subpaths[subpaths.length-1]) { switch (subpaths[subpaths.length-1]) {
case "gifs" -> tabType = "gifs"; case "gifs" -> tabType = "gifs";
case "images" -> tabType = "images"; case "images" -> tabType = "images";
case "search" -> logger.warn("No tab selected, defaulting to gifs"); case "search" -> LOGGER.warn("No tab selected, defaulting to gifs");
default -> logger.warn(String.format("Unsupported search tab %s, defaulting to gifs", subpaths[subpaths.length-1])); default -> LOGGER.warn(String.format("Unsupported search tab %s, defaulting to gifs", subpaths[subpaths.length-1]));
} }
} }
uri = new URIBuilder(String.format(SEARCH_ENDPOINT, tabType)); uri = new URIBuilder(String.format(SEARCH_ENDPOINT, tabType));