1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-29 16:50:10 +02:00

Fixed EromeRipper and added new test to EromerRipperTest.

This commit is contained in:
Tushar
2018-12-18 00:05:58 +05:30
parent c44525a266
commit f3dc4b4c95
2 changed files with 45 additions and 33 deletions

View File

@@ -124,12 +124,17 @@ public class EromeRipper extends AbstractHTMLRipper {
private List<String> getMediaFromPage(Document doc) { private List<String> getMediaFromPage(Document doc) {
List<String> results = new ArrayList<>(); List<String> results = new ArrayList<>();
for (Element el : doc.select("img.img-front")) { for (Element el : doc.select("img.img-front")) {
if (el.hasAttr("src")) {
if (el.attr("src").startsWith("https:")) { if (el.attr("src").startsWith("https:")) {
results.add(el.attr("src")); results.add(el.attr("src"));
} } else {
else {
results.add("https:" + el.attr("src")); results.add("https:" + el.attr("src"));
} }
} else if (el.hasAttr("data-src")) {
//to add images that are not loaded( as all images are lasyloaded as we scroll).
results.add(el.attr("data-src"));
}
} }
for (Element el : doc.select("source[label=HD]")) { for (Element el : doc.select("source[label=HD]")) {
if (el.attr("src").startsWith("https:")) { if (el.attr("src").startsWith("https:")) {

View File

@@ -1,6 +1,7 @@
package com.rarchives.ripme.tst.ripper.rippers; package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import com.rarchives.ripme.ripper.rippers.EromeRipper; import com.rarchives.ripme.ripper.rippers.EromeRipper;
@@ -22,14 +23,14 @@ public class EromeRipperTest extends RippersTest {
public void testGetAlbumsToQueue() throws IOException { public void testGetAlbumsToQueue() throws IOException {
URL url = new URL("https://www.erome.com/Jay-Jenna"); URL url = new URL("https://www.erome.com/Jay-Jenna");
EromeRipper ripper = new EromeRipper(url); EromeRipper ripper = new EromeRipper(url);
assert(2 >= ripper.getAlbumsToQueue(ripper.getFirstPage()).size()); assert (2 >= ripper.getAlbumsToQueue(ripper.getFirstPage()).size());
} }
public void testPageContainsAlbums() throws IOException { public void testPageContainsAlbums() throws IOException {
URL url = new URL("https://www.erome.com/Jay-Jenna"); URL url = new URL("https://www.erome.com/Jay-Jenna");
EromeRipper ripper = new EromeRipper(url); EromeRipper ripper = new EromeRipper(url);
assert(ripper.pageContainsAlbums(url)); assert (ripper.pageContainsAlbums(url));
assert(!ripper.pageContainsAlbums(new URL("https://www.erome.com/a/KbDAM1XT"))); assert (!ripper.pageContainsAlbums(new URL("https://www.erome.com/a/KbDAM1XT")));
} }
public void testRip() throws IOException { public void testRip() throws IOException {
@@ -37,4 +38,10 @@ public class EromeRipperTest extends RippersTest {
EromeRipper ripper = new EromeRipper(url); EromeRipper ripper = new EromeRipper(url);
testRipper(ripper); testRipper(ripper);
} }
public void testGetURLsFromPage() throws IOException {
URL url = new URL("https://www.erome.com/a/Tak8F2h6");
EromeRipper ripper = new EromeRipper(url);
assert (35 == ripper.getURLsFromPage(ripper.getFirstPage()).size());
}
} }