mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-14 09:54:40 +02:00
Update CfakeRipper to new site format (Fixes #2116)
This commit is contained in:
@@ -15,7 +15,6 @@ import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
|||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
|
|
||||||
public class CfakeRipper extends AbstractHTMLRipper {
|
public class CfakeRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
public CfakeRipper(URL url) throws IOException {
|
public CfakeRipper(URL url) throws IOException {
|
||||||
super(url);
|
super(url);
|
||||||
}
|
}
|
||||||
@@ -32,13 +31,13 @@ public class CfakeRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("https?://cfake\\.com/picture/([a-zA-Z1-9_-]*)/\\d+/?$");
|
Pattern p = Pattern.compile("https?://cfake\\.com/(?:picture|images/celebrity)/([a-zA-Z1-9_-]*)/\\d+/?$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
}
|
}
|
||||||
throw new MalformedURLException("Expected cfake URL format: " +
|
throw new MalformedURLException("Expected cfake URL format: " +
|
||||||
"cfake.com/picture/MODEL/ID - got " + url + " instead");
|
"cfake.com/images/celebrity/MODEL/ID - got " + url + " instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,8 +58,7 @@ public class CfakeRipper extends AbstractHTMLRipper {
|
|||||||
// This for stops that
|
// This for stops that
|
||||||
if (nextPage.equals("")) {
|
if (nextPage.equals("")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return Http.url("http://cfake.com" + nextPage).get();
|
return Http.url("http://cfake.com" + nextPage).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,4 +84,4 @@ public class CfakeRipper extends AbstractHTMLRipper {
|
|||||||
public void downloadURL(URL url, int index) {
|
public void downloadURL(URL url, int index) {
|
||||||
addURLToDownload(url, getPrefix(index));
|
addURLToDownload(url, getPrefix(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ import com.rarchives.ripme.ripper.rippers.CfakeRipper;
|
|||||||
|
|
||||||
public class CfakeRipperTest extends RippersTest {
|
public class CfakeRipperTest extends RippersTest {
|
||||||
public void testRip() throws IOException, URISyntaxException {
|
public void testRip() throws IOException, URISyntaxException {
|
||||||
CfakeRipper ripper = new CfakeRipper(new URI("http://cfake.com/picture/Zooey_Deschanel/1264").toURL());
|
CfakeRipper ripper = new CfakeRipper(new URI("https://cfake.com/images/celebrity/Zooey_Deschanel/1264").toURL());
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user