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;
elems = albumDoc.select(".post-title");
if (elems.size() > 0) {
Element postTitle = elems.get(0);
if (postTitle != null) {
title = postTitle.text();
}
logger.info("Trying to get album title");
elems = albumDoc.select("meta[property=og:title]");
if (elems!=null) {
title = elems.attr("content");
}
String albumTitle = "imgur_";
@ -138,18 +136,25 @@ public class ImgurRipper extends AlbumRipper {
case ALBUM:
// Fall-through
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);
break;
case SERIES_OF_IMAGES:
logger.info("Album type is SERIES_OF_IMAGES");
ripAlbum(this.url);
break;
case USER:
logger.info("Album type is USER");
ripUserAccount(url);
break;
case SUBREDDIT:
logger.info("Album type is SUBREDDIT");
ripSubreddit(url);
break;
case USER_IMAGES:
logger.info("Album type is USER_IMAGES");
ripUserImages(url);
break;
}