1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-29 16:50:10 +02:00

Merge pull request #1146 from cyian-1756/hentai-foundry-test-fix

Added an else block so the pdf download unit test wouldn't fail
This commit is contained in:
cyian-1756
2018-12-31 08:15:15 -05:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
Pattern p = Pattern.compile("^.*hentai-foundry\\.com/(pictures|stories)/user/([a-zA-Z0-9\\-_]+).*$"); Pattern p = Pattern.compile("^.*hentai-foundry\\.com/(pictures|stories)/user/([a-zA-Z0-9\\-_]+).*$");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return m.group(1); return m.group(2);
} }
throw new MalformedURLException( throw new MalformedURLException(
"Expected hentai-foundry.com gallery format: " "Expected hentai-foundry.com gallery format: "
@@ -135,6 +135,7 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
// this if is for ripping pdf stories // this if is for ripping pdf stories
if (url.toExternalForm().contains("/stories/")) { if (url.toExternalForm().contains("/stories/")) {
for (Element pdflink : doc.select("a.pdfLink")) { for (Element pdflink : doc.select("a.pdfLink")) {
LOGGER.info("grabbing " + "http://www.hentai-foundry.com" + pdflink.attr("href"));
imageURLs.add("http://www.hentai-foundry.com" + pdflink.attr("href")); imageURLs.add("http://www.hentai-foundry.com" + pdflink.attr("href"));
} }
return imageURLs; return imageURLs;
@@ -177,8 +178,9 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
// When downloading pdfs you *NEED* to end the cookies with the request or you just get the consent page // When downloading pdfs you *NEED* to end the cookies with the request or you just get the consent page
if (url.toExternalForm().endsWith(".pdf")) { if (url.toExternalForm().endsWith(".pdf")) {
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies); addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies);
} else {
addURLToDownload(url, getPrefix(index));
} }
addURLToDownload(url, getPrefix(index));
} }
} }

View File

@@ -11,6 +11,12 @@ public class HentaifoundryRipperTest extends RippersTest {
testRipper(ripper); testRipper(ripper);
} }
public void testHentaifoundryGetGID() throws IOException {
HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("https://www.hentai-foundry.com/stories/user/Rakked"));
testRipper(ripper);
assertEquals("Rakked", ripper.getGID(new URL("https://www.hentai-foundry.com/stories/user/Rakked")));
}
public void testHentaifoundryPdfRip() throws IOException { public void testHentaifoundryPdfRip() throws IOException {
HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("https://www.hentai-foundry.com/stories/user/Rakked")); HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("https://www.hentai-foundry.com/stories/user/Rakked"));
testRipper(ripper); testRipper(ripper);