Skip to content

Commit e7a531b

Browse files
Tush-rsoloturn
authored andcommitted
Fix imgur url scheme and remove json from logs
1 parent d439ff0 commit e7a531b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ public static ImgurAlbum getImgurAlbum(URL url) throws IOException, URISyntaxExc
255255
LOGGER.info(" Retrieving " + strUrl);
256256
Document doc = getAlbumData("https://api.imgur.com/3/album/" + strUrl.split("/a/")[1]);
257257
// Try to use embedded JSON to retrieve images
258-
LOGGER.info(Jsoup.clean(doc.body().toString(), Safelist.none()));
259-
260258
try {
261259
JSONObject json = new JSONObject(Jsoup.clean(doc.body().toString(), Safelist.none()));
262260
JSONArray jsonImages = json.getJSONObject("data").getJSONArray("images");
@@ -427,7 +425,7 @@ private void ripUserImages(URL url) {
427425
for (int i = 0; i < images.length(); i++) {
428426
imagesFound++;
429427
JSONObject image = images.getJSONObject(i);
430-
String imageUrl = "http://i.imgur.com/" + image.getString("hash") + image.getString("ext");
428+
String imageUrl = "https://i.imgur.com/" + image.getString("hash") + image.getString("ext");
431429
String prefix = "";
432430
if (Utils.getConfigBoolean("download.save_order", true)) {
433431
prefix = String.format("%03d_", imagesFound);
@@ -497,7 +495,7 @@ public String getGID(URL url) throws MalformedURLException, URISyntaxException {
497495
// Imgur album or gallery
498496
albumType = ALBUM_TYPE.ALBUM;
499497
String gid = m.group(m.groupCount());
500-
this.url = new URI("http://imgur.com/a/" + gid).toURL();
498+
this.url = new URI("https://imgur.com/a/" + gid).toURL();
501499
return gid;
502500
}
503501
// Match urls with path /a
@@ -507,7 +505,7 @@ public String getGID(URL url) throws MalformedURLException, URISyntaxException {
507505
// Imgur album or gallery
508506
albumType = ALBUM_TYPE.ALBUM;
509507
String gid = m.group(m.groupCount());
510-
this.url = new URI("http://imgur.com/a/" + gid).toURL();
508+
this.url = new URI("https://imgur.com/a/" + gid).toURL();
511509
return gid;
512510
}
513511
p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{4,})\\.imgur\\.com/?$");
@@ -563,7 +561,7 @@ public String getGID(URL url) throws MalformedURLException, URISyntaxException {
563561
albumType = ALBUM_TYPE.ALBUM;
564562
String subreddit = m.group(m.groupCount() - 1);
565563
String gid = m.group(m.groupCount());
566-
this.url = new URI("http://imgur.com/r/" + subreddit + "/" + gid).toURL();
564+
this.url = new URI("https://imgur.com/r/" + subreddit + "/" + gid).toURL();
567565
return "r_" + subreddit + "_" + gid;
568566
}
569567
p = Pattern.compile("^https?://(i\\.|www\\.|m\\.)?imgur\\.com/([a-zA-Z0-9]{5,})$");

0 commit comments

Comments
 (0)