Chan ripper now falls back on page title if thread title can not be found

This commit is contained in:
cyian-1756 2017-11-10 09:29:26 -05:00
parent 13162bed73
commit ffb26c2fe0

View File

@ -20,10 +20,8 @@ import com.rarchives.ripme.utils.RipUtils;
public class ChanRipper extends AbstractHTMLRipper { public class ChanRipper extends AbstractHTMLRipper {
private static List<ChanSite> explicit_domains = Arrays.asList( private static List<ChanSite> explicit_domains = Arrays.asList(
new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org")), new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org")),
new ChanSite(Arrays.asList("archive.moe"), Arrays.asList("data.archive.moe")),
new ChanSite(Arrays.asList("4archive.org"), Arrays.asList("imgur.com")), new ChanSite(Arrays.asList("4archive.org"), Arrays.asList("imgur.com")),
new ChanSite(Arrays.asList("archive.4plebs.org"), Arrays.asList("img.4plebs.org")), new ChanSite(Arrays.asList("archive.4plebs.org"), Arrays.asList("img.4plebs.org"))
new ChanSite(Arrays.asList("fgts.jp"), Arrays.asList("dat.fgtsi.org"))
); );
private static List<String> url_piece_blacklist = Arrays.asList( private static List<String> url_piece_blacklist = Arrays.asList(
@ -67,6 +65,10 @@ public class ChanRipper extends AbstractHTMLRipper {
// Attempt to use album title as GID // Attempt to use album title as GID
Document doc = getFirstPage(); Document doc = getFirstPage();
String subject = doc.select(".post.op > .postinfo > .subject").first().text(); String subject = doc.select(".post.op > .postinfo > .subject").first().text();
if (subject != null) {
return getHost() + "_" + getGID(url) + "_" + subject;
}
subject = doc.select("title").text();
return getHost() + "_" + getGID(url) + "_" + subject; return getHost() + "_" + getGID(url) + "_" + subject;
} catch (Exception e) { } catch (Exception e) {
// Fall back to default album naming convention // Fall back to default album naming convention