Changed imgur title grabbing to be less reliant on site style (#477)

This commit is contained in:
cyian-1756 2017-03-23 05:34:37 -04:00 committed by metaprime
parent a3d8e87639
commit 2ff45e8696

View File

@ -104,12 +104,10 @@ public class ImgurRipper extends AlbumRipper {
*/ */
String title = null; String title = null;
elems = albumDoc.select(".post-title"); logger.info("Trying to get album title");
if (elems.size() > 0) { elems = albumDoc.select("meta[property=og:title]");
Element postTitle = elems.get(0); if (elems!=null) {
if (postTitle != null) { title = elems.attr("content");
title = postTitle.text();
}
} }
String albumTitle = "imgur_"; String albumTitle = "imgur_";
@ -138,18 +136,25 @@ public class ImgurRipper extends AlbumRipper {
case ALBUM: case ALBUM:
// Fall-through // Fall-through
case USER_ALBUM: case USER_ALBUM:
logger.info("Album type is USER_ALBUM");
// Don't call getAlbumTitle(this.url) with this
// as it seems to cause the album to be downloaded to a subdir.
ripAlbum(this.url); ripAlbum(this.url);
break; break;
case SERIES_OF_IMAGES: case SERIES_OF_IMAGES:
logger.info("Album type is SERIES_OF_IMAGES");
ripAlbum(this.url); ripAlbum(this.url);
break; break;
case USER: case USER:
logger.info("Album type is USER");
ripUserAccount(url); ripUserAccount(url);
break; break;
case SUBREDDIT: case SUBREDDIT:
logger.info("Album type is SUBREDDIT");
ripSubreddit(url); ripSubreddit(url);
break; break;
case USER_IMAGES: case USER_IMAGES:
logger.info("Album type is USER_IMAGES");
ripUserImages(url); ripUserImages(url);
break; break;
} }