Imgur ripper no longer adds Imgur: The most awesome images on the Internet to titles

This commit is contained in:
cyian-1756 2017-06-22 09:37:55 -04:00
parent d30c4b606d
commit 36c86462ea

View File

@ -108,6 +108,13 @@ public class ImgurRipper extends AlbumRipper {
elems = albumDoc.select("meta[property=og:title]"); elems = albumDoc.select("meta[property=og:title]");
if (elems!=null) { if (elems!=null) {
title = elems.attr("content"); 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_"; String albumTitle = "imgur_";
@ -119,7 +126,7 @@ public class ImgurRipper extends AlbumRipper {
*/ */
albumTitle += gid; albumTitle += gid;
if (title != null) { if (title != null) {
albumTitle += " (" + title + ")"; albumTitle += "_" + title;
} }
return albumTitle; return albumTitle;
@ -241,8 +248,8 @@ public class ImgurRipper extends AlbumRipper {
.get(); .get();
// Try to use embedded JSON to retrieve images // Try to use embedded JSON to retrieve images
p = Pattern.compile("^.*widgetFactory.mergeConfig\\('gallery', (.*?)\\);.*$", Pattern.DOTALL); Pattern p = Pattern.compile("^.*widgetFactory.mergeConfig\\('gallery', (.*?)\\);.*$", Pattern.DOTALL);
m = p.matcher(doc.body().html()); Matcher m = p.matcher(doc.body().html());
if (m.matches()) { if (m.matches()) {
try { try {
ImgurAlbum imgurAlbum = new ImgurAlbum(url); ImgurAlbum imgurAlbum = new ImgurAlbum(url);