mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-01-16 20:28:15 +01:00
Remove Cyberdrop - site is permanently offline
This commit is contained in:
parent
6ede556c6f
commit
427a03beba
@ -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<String> getURLsFromPage(Document page) {
|
||||
ArrayList<String> urls = new ArrayList<>();
|
||||
for (Element element: page.getElementsByClass("image")) {
|
||||
urls.add(element.attr("href"));
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
}
|
@ -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<URL, String> 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<URL> testURLs = new ArrayList<URL>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user