Skip to content

Commit

Permalink
Updated xhamster ripper to support new URL format
Browse files Browse the repository at this point in the history
Fixes 4pr0n/ripme#593
Fixes #4
  • Loading branch information
lukepayne authored and metaprime committed Jul 5, 2017
1 parent 021cd03 commit cfab32d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public XhamsterRipper(URL url) throws IOException {

@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();
}
Expand Down Expand Up @@ -87,14 +87,14 @@ public String getHost() {

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void testVkPhotosRip() throws IOException {
}

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);
}
}

0 comments on commit cfab32d

Please sign in to comment.