From 36c86462eadd8345f6a5612bb66b40c6424a653b Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Thu, 22 Jun 2017 09:37:55 -0400 Subject: [PATCH] Imgur ripper no longer adds Imgur: The most awesome images on the Internet to titles --- .../rarchives/ripme/ripper/rippers/ImgurRipper.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java index 3c43bd29..984b946e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java @@ -108,6 +108,13 @@ public class ImgurRipper extends AlbumRipper { elems = albumDoc.select("meta[property=og:title]"); if (elems!=null) { title = elems.attr("content"); + logger.debug("[*] Title is " + title); + } + // This is here encase the album is unnamed, to prevent + // Imgur: The most awesome images on the Internet from being added onto the album name + if (title.contains("Imgur: The most awesome images on the Internet")) { + logger.debug("[*] Album is untitled or imgur is return no title"); + title = ""; } String albumTitle = "imgur_"; @@ -119,7 +126,7 @@ public class ImgurRipper extends AlbumRipper { */ albumTitle += gid; if (title != null) { - albumTitle += " (" + title + ")"; + albumTitle += "_" + title; } return albumTitle; @@ -241,8 +248,8 @@ public class ImgurRipper extends AlbumRipper { .get(); // Try to use embedded JSON to retrieve images - p = Pattern.compile("^.*widgetFactory.mergeConfig\\('gallery', (.*?)\\);.*$", Pattern.DOTALL); - m = p.matcher(doc.body().html()); + Pattern p = Pattern.compile("^.*widgetFactory.mergeConfig\\('gallery', (.*?)\\);.*$", Pattern.DOTALL); + Matcher m = p.matcher(doc.body().html()); if (m.matches()) { try { ImgurAlbum imgurAlbum = new ImgurAlbum(url);