Merge pull request #694 from cyian-1756/xhamsterSubdomainFixes

XhamsterRipper now accepts all countries subdomains
This commit is contained in:
cyian-1756 2018-06-15 15:06:09 -04:00 committed by GitHub
commit 55e22e7d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
@Override @Override
public boolean canRip(URL url) { public boolean canRip(URL url) {
Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*?(\\d+)$"); Pattern p = Pattern.compile("^https?://([\\w\\w]*\\.)?xhamster\\.com/photos/gallery/.*?(\\d+)$");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
return m.matches(); return m.matches();
} }

View File

@ -17,6 +17,11 @@ public class XhamsterRipperTest extends RippersTest {
testRipper(ripper); testRipper(ripper);
} }
public void testBrazilianXhamster() throws IOException {
XhamsterRipper ripper = new XhamsterRipper(new URL("https://pt.xhamster.com/photos/gallery/silvana-7105696"));
testRipper(ripper);
}
public void testGetGID() throws IOException { public void testGetGID() throws IOException {
URL url = new URL("https://xhamster.com/photos/gallery/japanese-dolls-4-asahi-mizuno-7254664"); URL url = new URL("https://xhamster.com/photos/gallery/japanese-dolls-4-asahi-mizuno-7254664");
XhamsterRipper ripper = new XhamsterRipper(url); XhamsterRipper ripper = new XhamsterRipper(url);