mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-17 03:14:03 +02:00
Remove AerisdiesRipper - site is gone; has been offline since 2021
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AerisdiesRipper extends AbstractHTMLRipper {
|
||||
|
||||
private Map<String,String> cookies = new HashMap<>();
|
||||
|
||||
|
||||
public AerisdiesRipper(URL url) throws IOException {
|
||||
super(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "aerisdies";
|
||||
}
|
||||
@Override
|
||||
public String getDomain() {
|
||||
return "aerisdies.com";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGID(URL url) throws MalformedURLException {
|
||||
Pattern p = Pattern.compile("^https?://www.aerisdies.com/html/lb/[a-z]*_(\\d+)_\\d\\.html");
|
||||
Matcher m = p.matcher(url.toExternalForm());
|
||||
if (m.matches()) {
|
||||
return m.group(1);
|
||||
}
|
||||
throw new MalformedURLException("Expected URL format: http://www.aerisdies.com/html/lb/albumDIG, got: " + url);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlbumTitle(URL url) throws MalformedURLException, URISyntaxException {
|
||||
try {
|
||||
Element el = getCachedFirstPage().select(".headtext").first();
|
||||
if (el == null) {
|
||||
throw new IOException("Unable to get album title");
|
||||
}
|
||||
String title = el.text();
|
||||
return getHost() + "_" + getGID(url) + "_" + title.trim();
|
||||
} catch (IOException e) {
|
||||
// Fall back to default album naming convention
|
||||
LOGGER.info("Unable to find title at " + url);
|
||||
}
|
||||
return super.getAlbumTitle(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getURLsFromPage(Document page) {
|
||||
List<String> imageURLs = new ArrayList<>();
|
||||
Elements albumElements = page.select("div.imgbox > a > img");
|
||||
for (Element imageBox : albumElements) {
|
||||
String imageUrl = imageBox.attr("src");
|
||||
imageUrl = imageUrl.replaceAll("thumbnails", "images");
|
||||
imageUrl = imageUrl.replaceAll("../../", "");
|
||||
imageUrl = imageUrl.replaceAll("gif", "jpg");
|
||||
imageURLs.add("http://www.aerisdies.com/" + imageUrl);
|
||||
}
|
||||
return imageURLs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadURL(URL url, int index) {
|
||||
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(int index) {
|
||||
return String.format("%03d_", index);
|
||||
}
|
||||
}
|
@@ -1,45 +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.AerisdiesRipper;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class AerisdiesRipperTest extends RippersTest {
|
||||
@Test
|
||||
@Tag("flaky")
|
||||
public void testAlbum() throws IOException, URISyntaxException {
|
||||
AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/alb_1097_1.html").toURL());
|
||||
testRipper(ripper);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Tag("flaky")
|
||||
public void testSubAlbum() throws IOException, URISyntaxException {
|
||||
AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/alb_3692_1.html").toURL());
|
||||
testRipper(ripper);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Tag("flaky")
|
||||
public void testDjAlbum() throws IOException, URISyntaxException {
|
||||
AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/douj_5230_1.html").toURL());
|
||||
testRipper(ripper);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Tag("flaky")
|
||||
public void testGetGID() throws IOException, URISyntaxException {
|
||||
URL url = new URI("http://www.aerisdies.com/html/lb/douj_5230_1.html").toURL();
|
||||
AerisdiesRipper ripper = new AerisdiesRipper(url);
|
||||
Assertions.assertEquals("5230", ripper.getGID(url));
|
||||
}
|
||||
|
||||
// TODO: Add a test for an album with a title.
|
||||
}
|
Reference in New Issue
Block a user