From 4ae28c3af3e35586d91c0dcbc06bbc107986becc Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Thu, 22 Jun 2017 09:48:17 -0400 Subject: [PATCH] Improved imgur title grabbing --- .../ripme/ripper/rippers/ImgurRipper.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 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 984b946e..4cfcb355 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java @@ -108,13 +108,25 @@ public class ImgurRipper extends AlbumRipper { elems = albumDoc.select("meta[property=og:title]"); if (elems!=null) { title = elems.attr("content"); - logger.debug("[*] Title is " + title); + 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"); + logger.debug("Album is untitled or imgur is returning the default title"); + // We set the title to "" here because if it's found in the next few attempts it will be changed + // but if it's nto found there will be no reason to set it later title = ""; + logger.debug("Trying to use title tag to get title"); + elems = albumDoc.select("title"); + if (elems!=null) { + if (elems.text().contains("Imgur: The most awesome images on the Internet")) { + logger.debug("Was unable to get album title or album was untitled"); + } + else { + title = elems.text(); + } + } } String albumTitle = "imgur_";