diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/CyberdropRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/CyberdropRipper.java deleted file mode 100644 index 81a39823..00000000 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/CyberdropRipper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.rarchives.ripme.ripper.rippers; - -import java.io.IOException; -import java.net.*; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.rarchives.ripme.ripper.AbstractHTMLRipper; -import com.rarchives.ripme.utils.Http; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; - -public class CyberdropRipper extends AbstractHTMLRipper { - - public CyberdropRipper(URL url) throws IOException { - super(url); - } - - @Override - public String getHost() { - return "cyberdrop"; - } - - @Override - public String getDomain() { - return "cyberdrop.me"; - } - - @Override - public String getGID(URL url) throws MalformedURLException { - Pattern p = Pattern.compile("^https?://cyberdrop\\.me/a/([a-zA-Z0-9]+).*?$"); - Matcher m = p.matcher(url.toExternalForm()); - if (m.matches()) { - return m.group(1); - } - throw new MalformedURLException("Expected cyberdrop.me URL format: " + - "https://cyberdrop.me/a/xxxxxxxx - got " + url + "instead"); - } - - @Override - public void downloadURL(URL url, int index) { - addURLToDownload(url, getPrefix(index)); - } - - @Override - protected List getURLsFromPage(Document page) { - ArrayList urls = new ArrayList<>(); - for (Element element: page.getElementsByClass("image")) { - urls.add(element.attr("href")); - } - return urls; - } -} \ No newline at end of file diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java deleted file mode 100644 index 14fcef07..00000000 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.rarchives.ripme.tst.ripper.rippers; - -import com.rarchives.ripme.ripper.rippers.CyberdropRipper; -import com.rarchives.ripme.utils.Http; -import org.jsoup.nodes.Document; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class CyberdropRipperTest extends RippersTest { - @Test - public void testScrolllerGID() throws IOException, URISyntaxException { - Map testURLs = new HashMap<>(); - - testURLs.put(new URI("https://cyberdrop.me/a/n4umdBjw").toURL(), "n4umdBjw"); - testURLs.put(new URI("https://cyberdrop.me/a/iLtp4BjW").toURL(), "iLtp4BjW"); - for (URL url : testURLs.keySet()) { - CyberdropRipper ripper = new CyberdropRipper(url); - ripper.setup(); - Assertions.assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL())); - deleteDir(ripper.getWorkingDir()); - } - } - - @Test - @Tag("flaky") - public void testCyberdropNumberOfFiles() throws IOException, URISyntaxException { - List testURLs = new ArrayList(); - - testURLs.add(new URI("https://cyberdrop.me/a/n4umdBjw").toURL()); - testURLs.add(new URI("https://cyberdrop.me/a/iLtp4BjW").toURL()); - for (URL url : testURLs) { - Assertions.assertTrue(willDownloadAllFiles(url)); - } - } - - public boolean willDownloadAllFiles(URL url) throws IOException { - Document doc = Http.url(url).get(); - long numberOfLinks = doc.getElementsByClass("image").stream().count(); - int numberOfFiles = Integer.parseInt(doc.getElementById("totalFilesAmount").text()); - return numberOfLinks == numberOfFiles; - } - - - -} \ No newline at end of file