Hentaifoundry ripper no long throws a null error when getting the next page; No longer makes unneeded requests
This commit is contained in:
parent
1dadd26e05
commit
7d3c7f2b20
@ -52,16 +52,16 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
|
|||||||
Response resp = Http.url("http://www.hentai-foundry.com/").response();
|
Response resp = Http.url("http://www.hentai-foundry.com/").response();
|
||||||
cookies = resp.cookies();
|
cookies = resp.cookies();
|
||||||
resp = Http.url("http://www.hentai-foundry.com/?enterAgree=1&size=1500")
|
resp = Http.url("http://www.hentai-foundry.com/?enterAgree=1&size=1500")
|
||||||
.referrer("http://www.hentai-foundry.com/")
|
.referrer("http://www.hentai-foundry.com/")
|
||||||
.cookies(cookies)
|
.cookies(cookies)
|
||||||
.response();
|
.response();
|
||||||
// The only cookie that seems to matter in getting around the age wall is the phpsession cookie
|
// The only cookie that seems to matter in getting around the age wall is the phpsession cookie
|
||||||
cookies.putAll(resp.cookies());
|
cookies.putAll(resp.cookies());
|
||||||
sleep(500);
|
sleep(500);
|
||||||
resp = Http.url(url)
|
resp = Http.url(url)
|
||||||
.referrer("http://www.hentai-foundry.com/")
|
.referrer("http://www.hentai-foundry.com/")
|
||||||
.cookies(cookies)
|
.cookies(cookies)
|
||||||
.response();
|
.response();
|
||||||
cookies.putAll(resp.cookies());
|
cookies.putAll(resp.cookies());
|
||||||
return resp.parse();
|
return resp.parse();
|
||||||
}
|
}
|
||||||
@ -74,12 +74,16 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
Elements els = doc.select("li.next > a");
|
Elements els = doc.select("li.next > a");
|
||||||
Element first = els.first();
|
Element first = els.first();
|
||||||
String nextURL = first.attr("href");
|
try {
|
||||||
nextURL = "http://www.hentai-foundry.com" + nextURL;
|
String nextURL = first.attr("href");
|
||||||
return Http.url(nextURL)
|
nextURL = "http://www.hentai-foundry.com" + nextURL;
|
||||||
.referrer(url)
|
return Http.url(nextURL)
|
||||||
.cookies(cookies)
|
.referrer(url)
|
||||||
.get();
|
.cookies(cookies)
|
||||||
|
.get();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
throw new IOException("No more pages");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -100,9 +104,9 @@ public class HentaifoundryRipper extends AbstractHTMLRipper {
|
|||||||
Response resp = Http.url("http://www.hentai-foundry.com/").response();
|
Response resp = Http.url("http://www.hentai-foundry.com/").response();
|
||||||
cookies = resp.cookies();
|
cookies = resp.cookies();
|
||||||
resp = Http.url("http://www.hentai-foundry.com/?enterAgree=1&size=1500")
|
resp = Http.url("http://www.hentai-foundry.com/?enterAgree=1&size=1500")
|
||||||
.referrer("http://www.hentai-foundry.com/")
|
.referrer("http://www.hentai-foundry.com/")
|
||||||
.cookies(cookies)
|
.cookies(cookies)
|
||||||
.response();
|
.response();
|
||||||
cookies.putAll(resp.cookies());
|
cookies.putAll(resp.cookies());
|
||||||
|
|
||||||
logger.info("grabbing " + "http://www.hentai-foundry.com" + thumb.attr("href"));
|
logger.info("grabbing " + "http://www.hentai-foundry.com" + thumb.attr("href"));
|
||||||
|
Loading…
Reference in New Issue
Block a user