Skip to content

Commit

Permalink
Suppress warnings in DeviantartRipper and provide justification.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaprime committed Feb 3, 2025
1 parent 672c3c2 commit 647de8f
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ private void login() throws IOException {
logger.info("DA Cookies: " + getDACookie());
}


/**
* Returns next page Document using offset.
*/
Expand All @@ -246,7 +245,6 @@ public Document getNextPage(Document doc) throws IOException {
}

return Http.url(urlWithParams(this.offset)).referrer(referer).userAgent(userAgent).cookies(getDACookie()).get();

}

/**
Expand All @@ -258,7 +256,6 @@ public Document getNextPage(Document doc) throws IOException {
*/
@Override
protected List<String> getURLsFromPage(Document page) {

List<String> result = new ArrayList<String>();

Element div;
Expand Down Expand Up @@ -293,6 +290,11 @@ protected void downloadURL(URL url, int index) {
logger.info("Downloading URL Number " + this.downloadCount);
logger.info("Deviant Art URL: " + url.toExternalForm());
try {
// Suppress this warning because it is part of code that was temporarily
// commented out to disable the behavior.
// We know there's a lot about this ripper that needs to be fixed so
// we're not too worried about warnings in this file.
@SuppressWarnings("unused")
Response re = Http.url(urlWithParams(this.offset)).cookies(getDACookie()).referrer(referer)
.userAgent(userAgent).response();
//updateCookie(re.cookies());
Expand All @@ -319,7 +321,6 @@ public String normalizeUrl(String url) {
*/
@Override
public String getGID(URL url) throws MalformedURLException {

String s = url.toExternalForm();
String artist = "unknown";
String what = "unknown";
Expand Down Expand Up @@ -366,7 +367,6 @@ public String getGID(URL url) throws MalformedURLException {
logger.info("Album Name: " + artist + "_" + what + "_" + albumname);

return artist + "_" + what + "_" + albumname;

}

/**
Expand Down Expand Up @@ -413,7 +413,6 @@ private Map<String, String> getDACookie() {
* @param m new Cookies
*/
private void updateCookie(Map<String, String> m) {

if (m == null) {
return;
}
Expand All @@ -439,7 +438,6 @@ private void updateCookie(Map<String, String> m) {
} catch (IOException e) {
e.printStackTrace();
}

}

/**
Expand Down Expand Up @@ -470,8 +468,13 @@ private String serialize(Serializable o) throws IOException {
private Map<String, String> deserialize(String s) throws IOException, ClassNotFoundException {
byte[] data = Base64.getDecoder().decode(s);
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
HashMap<String, String> o = (HashMap<String, String>) ois.readObject(); // Unchecked cast here but should never
// be something else

// Suppress this warning because it's part of the legacy implementation.
// We know there's a lot about this ripper that needs to be fixed so
// we're not too worried about warnings in this file.
// Unchecked cast here but should never be something else.
@SuppressWarnings("unchecked")
HashMap<String, String> o = (HashMap<String, String>) ois.readObject();
ois.close();
return o;
}
Expand Down

0 comments on commit 647de8f

Please sign in to comment.