Skip to content

Commit 7cd39c8

Browse files
committed
Fix FitnakedgirlsRipper and add FitnakedgirlsRipperTest (Fixes #2097)
1 parent f2c9974 commit 7cd39c8

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

src/main/java/com/rarchives/ripme/ripper/rippers/FitnakedgirlsRipper.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public String getGID(URL url) throws MalformedURLException {
3535
Pattern p;
3636
Matcher m;
3737

38-
p = Pattern.compile("^.*fitnakedgirls\\.com/gallery/(.+)$");
38+
p = Pattern.compile("^https?://(\\w+\\.)?fitnakedgirls\\.com/photos/gallery/(.+)$");
3939
m = p.matcher(url.toExternalForm());
4040
if (m.matches()) {
41-
return m.group(1);
41+
return m.group(2);
4242
}
4343

4444
throw new MalformedURLException(
@@ -49,9 +49,15 @@ public String getGID(URL url) throws MalformedURLException {
4949
public List<String> getURLsFromPage(Document doc) {
5050
List<String> imageURLs = new ArrayList<>();
5151

52-
Elements imgs = doc.select("div[class*=wp-tiles-tile-bg] > img");
52+
Elements imgs = doc.select(".entry-inner img");
5353
for (Element img : imgs) {
54-
String imgSrc = img.attr("src");
54+
String imgSrc = img.attr("data-src");
55+
if (imgSrc.strip().isEmpty()) {
56+
imgSrc = img.attr("src");
57+
if (imgSrc.strip().isEmpty()) {
58+
continue;
59+
}
60+
}
5561
imageURLs.add(imgSrc);
5662
}
5763

@@ -60,7 +66,10 @@ public List<String> getURLsFromPage(Document doc) {
6066

6167
@Override
6268
public void downloadURL(URL url, int index) {
69+
// site is slow and goes down easily so don't overwhelm it
70+
sleep(1000);
71+
6372
// Send referrer when downloading images
6473
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), null);
6574
}
66-
}
75+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.rarchives.ripme.tst.ripper.rippers;
2+
3+
import java.io.IOException;
4+
import java.net.URI;
5+
import java.net.URISyntaxException;
6+
7+
import org.junit.jupiter.api.Test;
8+
9+
import com.rarchives.ripme.ripper.rippers.FitnakedgirlsRipper;
10+
11+
public class FitnakedgirlsRipperTest extends RippersTest {
12+
@Test
13+
public void testRip() throws IOException, URISyntaxException {
14+
FitnakedgirlsRipper ripper = new FitnakedgirlsRipper(new URI("https://fitnakedgirls.com/photos/gallery/erin-ashford-nude/").toURL());
15+
testRipper(ripper);
16+
}
17+
}

0 commit comments

Comments
 (0)