Updated xhamster ripper to support new URL format

Fixes 4pr0n/ripme#593
Fixes ripmeapp/ripme#4
This commit is contained in:
Luke Payne 2017-07-02 12:11:55 +09:30 committed by metaprime
parent 021cd031ee
commit cfab32d271
2 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ public class XhamsterRipper extends AlbumRipper {
@Override
public boolean canRip(URL url) {
Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/[0-9]+.*$");
Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*[0-9]+$");
Matcher m = p.matcher(url.toExternalForm());
return m.matches();
}
@ -87,14 +87,14 @@ public class XhamsterRipper extends AlbumRipper {
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://([a-z0-9.]*?)xhamster\\.com/photos/gallery/([0-9]{1,})/.*\\.html");
Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*?(\\d{1,})$");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(2);
return m.group(1);
}
throw new MalformedURLException(
"Expected xhamster.com gallery formats: "
+ "xhamster.com/photos/gallery/#####/xxxxx..html"
+ "xhamster.com/photos/gallery/xxxxx-#####"
+ " Got: " + url);
}

View File

@ -276,7 +276,7 @@ public class BasicRippersTest extends RippersTest {
}
public void testXhamsterAlbums() throws IOException {
XhamsterRipper ripper = new XhamsterRipper(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html"));
XhamsterRipper ripper = new XhamsterRipper(new URL("https://xhamster.com/photos/gallery/volleyball-sluts-8305007"));
testRipper(ripper);
}
}