Merge pull request #201 from cyian-1756/anon-ib

chanRipper now falls back to  getHost() and getGID(), not page title
This commit is contained in:
cyian-1756 2017-11-16 17:52:40 -05:00 committed by GitHub
commit 2e1d78f179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,12 +70,12 @@ public class ChanRipper extends AbstractHTMLRipper {
} catch (NullPointerException e) {
logger.warn("Failed to get thread title from " + url);
}
return doc.select("title").first().text();
} catch (Exception e) {
// Fall back to default album naming convention
logger.warn("Failed to get album title from " + url, e);
}
return super.getAlbumTitle(url);
// Fall back on the GID
return getHost() + "_" + getGID(url);
}
@Override
@ -117,6 +117,12 @@ public class ChanRipper extends AbstractHTMLRipper {
if (m.matches()) {
return m.group(1);
}
// xchan
p = Pattern.compile("^.*\\.[a-z]{1,3}/board/[a-zA-Z0-9]+/thread/([0-9]+)/?.*$");
m = p.matcher(u);
if (m.matches()) {
return m.group(1);
}
}
throw new MalformedURLException(
@ -211,6 +217,6 @@ public class ChanRipper extends AbstractHTMLRipper {
@Override
public void downloadURL(URL url, int index) {
addURLToDownload(url, getPrefix(index), "", this.url.toString(), null);
addURLToDownload(url, getPrefix(index));
}
}