1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-27 15:49:50 +02:00

Merge pull request #1103 from cyian-1756/HentaiFoundryStories

Added support for Hentai foundry stories
This commit is contained in:
cyian-1756
2018-12-14 08:15:22 -05:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^.*hentai-foundry\\.com/pictures/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());
if (m.matches()) {
return m.group(1);
@@ -132,6 +132,13 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> imageURLs = new ArrayList<>();
// this if is for ripping pdf stories
if (url.toExternalForm().contains("/stories/")) {
for (Element pdflink : doc.select("a.pdfLink")) {
imageURLs.add("http://www.hentai-foundry.com" + pdflink.attr("href"));
}
return imageURLs;
}
Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*");
for (Element thumb : doc.select("div.thumb_square > a.thumbLink")) {
if (isStopped()) {
@@ -167,6 +174,10 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
@Override
public void downloadURL(URL url, int index) {
// When downloading pdfs you *NEED* to end the cookies with the request or you just get the consent page
if (url.toExternalForm().endsWith(".pdf")) {
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies);
}
addURLToDownload(url, getPrefix(index));
}

View File

@@ -7,7 +7,12 @@ import com.rarchives.ripme.ripper.rippers.HentaifoundryRipper;
public class HentaifoundryRipperTest extends RippersTest {
public void testHentaifoundryRip() throws IOException {
HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("http://www.hentai-foundry.com/pictures/user/personalami"));
HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("https://www.hentai-foundry.com/pictures/user/personalami"));
testRipper(ripper);
}
public void testHentaifoundryPdfRip() throws IOException {
HentaifoundryRipper ripper = new HentaifoundryRipper(new URL("https://www.hentai-foundry.com/stories/user/Rakked"));
testRipper(ripper);
}
}