Merge pull request #606 from cyian-1756/hentai2readQuickQueue
Added quick queue support for hentai2read ripper
This commit is contained in:
commit
7198cf8b95
@ -31,21 +31,50 @@ public class Hentai2readRipper extends AbstractHTMLRipper {
|
|||||||
return "hentai2read.com";
|
return "hentai2read.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public boolean hasQueueSupport() {
|
||||||
Pattern p = Pattern.compile("https?://hentai2read\\.com/([a-zA-Z0-9_-]*)/(\\d)?/?");
|
return true;
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
}
|
||||||
if (m.matches()) {
|
|
||||||
return m.group(1);
|
@Override
|
||||||
}
|
public boolean pageContainsAlbums(URL url) {
|
||||||
throw new MalformedURLException("Expected hentai2read.com URL format: " +
|
logger.info("Page contains albums");
|
||||||
"hbrowse.com/COMICID - got " + url + " instead");
|
Pattern pat = Pattern.compile("https?://hentai2read\\.com/([a-zA-Z0-9_-]*)/?");
|
||||||
|
Matcher mat = pat.matcher(url.toExternalForm());
|
||||||
|
if (mat.matches()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getAlbumsToQueue(Document doc) {
|
||||||
|
List<String> urlsToAddToQueue = new ArrayList<>();
|
||||||
|
for (Element elem : doc.select(".nav-chapters > li > div.media > a")) {
|
||||||
|
urlsToAddToQueue.add(elem.attr("href"));
|
||||||
|
}
|
||||||
|
return urlsToAddToQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
|
Pattern p = Pattern.compile("https?://hentai2read\\.com/([a-zA-Z0-9_-]*)/(\\d+)?/?");
|
||||||
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
return m.group(1) + "_" + m.group(2);
|
||||||
|
}
|
||||||
|
throw new MalformedURLException("Expected hentai2read.com URL format: " +
|
||||||
|
"hentai2read.com/COMICID - got " + url + " instead");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document getFirstPage() throws IOException {
|
public Document getFirstPage() throws IOException {
|
||||||
String thumbnailLink;
|
String thumbnailLink;
|
||||||
try {
|
try {
|
||||||
|
// If the page contains albums we want to load the main page
|
||||||
|
if (pageContainsAlbums(url)) {
|
||||||
|
return Http.url(url).get();
|
||||||
|
}
|
||||||
Document tempDoc;
|
Document tempDoc;
|
||||||
tempDoc = Http.url(url).get();
|
tempDoc = Http.url(url).get();
|
||||||
// Get the thumbnail page so we can rip all images without loading every page in the comic
|
// Get the thumbnail page so we can rip all images without loading every page in the comic
|
||||||
|
@ -7,9 +7,7 @@ import com.rarchives.ripme.ripper.rippers.Hentai2readRipper;
|
|||||||
|
|
||||||
public class Hentai2readRipperTest extends RippersTest {
|
public class Hentai2readRipperTest extends RippersTest {
|
||||||
public void testHentai2readAlbum() throws IOException {
|
public void testHentai2readAlbum() throws IOException {
|
||||||
Hentai2readRipper ripper = new Hentai2readRipper(new URL("https://hentai2read.com/sm_school_memorial/"));
|
Hentai2readRipper ripper = new Hentai2readRipper(new URL("https://hentai2read.com/sm_school_memorial/1/"));
|
||||||
testRipper(ripper);
|
|
||||||
ripper = new Hentai2readRipper(new URL("https://hentai2read.com/sm_school_memorial/1/"));
|
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user