mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-18 03:31:24 +02:00
Removed ManganeloRipper (permanently down)
This commit is contained in:
@@ -1,109 +0,0 @@
|
|||||||
package com.rarchives.ripme.ripper.rippers;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
|
||||||
import com.rarchives.ripme.utils.Http;
|
|
||||||
|
|
||||||
public class ManganeloRipper extends AbstractHTMLRipper {
|
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(ManganeloRipper.class);
|
|
||||||
|
|
||||||
public ManganeloRipper(URL url) throws IOException {
|
|
||||||
super(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHost() {
|
|
||||||
return "manganelo";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDomain() {
|
|
||||||
return "manganelo.com";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
|
||||||
Pattern p = Pattern.compile("https?://manganelo.com/manga/([\\S]+)/?$");
|
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
|
||||||
if (m.matches()) {
|
|
||||||
return m.group(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
p = Pattern.compile("https?://manganelo.com/chapter/([\\S]+)/([\\S_\\-]+)/?$");
|
|
||||||
m = p.matcher(url.toExternalForm());
|
|
||||||
if (m.matches()) {
|
|
||||||
return m.group(1);
|
|
||||||
}
|
|
||||||
throw new MalformedURLException("Expected manganelo URL format: " +
|
|
||||||
"/manganelo.com/manga/ID - got " + url + " instead");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Document getNextPage(Document doc) throws IOException {
|
|
||||||
Element elem = doc.select("div.btn-navigation-chap > a.back").first();
|
|
||||||
if (elem == null) {
|
|
||||||
throw new IOException("No more pages");
|
|
||||||
} else {
|
|
||||||
return Http.url(elem.attr("href")).get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getURLsFromChap(String url) {
|
|
||||||
List<String> result = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Document doc = Http.url(url).get();
|
|
||||||
|
|
||||||
return getURLsFromChap(doc);
|
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getURLsFromChap(Document doc) {
|
|
||||||
logger.debug("Getting urls from " + doc.location());
|
|
||||||
List<String> result = new ArrayList<>();
|
|
||||||
for (Element el : doc.select(".vung-doc > img")) {
|
|
||||||
result.add(el.attr("src"));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
|
||||||
List<String> result = new ArrayList<>();
|
|
||||||
List<String> urlsToGrab = new ArrayList<>();
|
|
||||||
if (url.toExternalForm().contains("/manga/")) {
|
|
||||||
for (Element el : doc.select("div.chapter-list > div.row > span > a")) {
|
|
||||||
urlsToGrab.add(el.attr("href"));
|
|
||||||
}
|
|
||||||
Collections.reverse(urlsToGrab);
|
|
||||||
|
|
||||||
for (String url : urlsToGrab) {
|
|
||||||
result.addAll(getURLsFromChap(url));
|
|
||||||
}
|
|
||||||
} else if (url.toExternalForm().contains("/chapter/")) {
|
|
||||||
result.addAll(getURLsFromChap(doc));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void downloadURL(URL url, int index) {
|
|
||||||
addURLToDownload(url, getPrefix(index));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
package com.rarchives.ripme.tst.ripper.rippers;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.ManganeloRipper;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
public class ManganeloRipperTest extends RippersTest {
|
|
||||||
@Test
|
|
||||||
@Disabled("no images found, test or ripper broken")
|
|
||||||
public void testRip() throws IOException, URISyntaxException {
|
|
||||||
ManganeloRipper ripper = new ManganeloRipper(new URI("https://manganelo.com/manga/demonic_housekeeper").toURL());
|
|
||||||
testRipper(ripper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetGID() throws IOException, URISyntaxException {
|
|
||||||
URL url = new URI("https://manganelo.com/manga/demonic_housekeeper").toURL();
|
|
||||||
ManganeloRipper ripper = new ManganeloRipper(url);
|
|
||||||
Assertions.assertEquals("demonic_housekeeper", ripper.getGID(url));
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user