mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-07 06:16:42 +02:00
xhamster5.desi is a valid domain
This commit is contained in:
@@ -48,8 +48,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
String URLToReturn = url.toExternalForm();
|
String URLToReturn = url.toExternalForm();
|
||||||
URLToReturn = URLToReturn.replaceAll("https?://\\w?\\w?\\.?xhamster\\.", "https://m.xhamster.");
|
URLToReturn = URLToReturn.replaceAll("https?://\\w?\\w?\\.?xhamster([^<]*)\\.", "https://m.xhamster$1.");
|
||||||
URLToReturn = URLToReturn.replaceAll("https?://xhamster2\\.", "https://m.xhamster2.");
|
|
||||||
URL san_url = new URL(URLToReturn);
|
URL san_url = new URL(URLToReturn);
|
||||||
LOGGER.info("sanitized URL is " + san_url.toExternalForm());
|
LOGGER.info("sanitized URL is " + san_url.toExternalForm());
|
||||||
return san_url;
|
return san_url;
|
||||||
@@ -57,20 +56,20 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^https?://[\\w\\w.]*xhamster2?\\.com/photos/gallery/.*?(\\d+)$");
|
Pattern p = Pattern.compile("^https?://([\\w\\w]*\\.)?xhamster([^<]*)\\.(com|one|desi)/photos/gallery/.*?(\\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(4);
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://[\\w\\w.]*xhamster2?\\.com/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
p = Pattern.compile("^https?://[\\w\\w.]*xhamster([^<]*)\\.(com|one|desi)/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return "user_" + m.group(1);
|
return "user_" + m.group(1);
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://.*xhamster2?\\.com/(movies|videos)/(.*)$");
|
p = Pattern.compile("^https?://.*xhamster([^<]*)\\.(com|one|desi)/(movies|videos)/(.*$)");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(2);
|
return m.group(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new MalformedURLException(
|
throw new MalformedURLException(
|
||||||
@@ -97,7 +96,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pageContainsAlbums(URL url) {
|
public boolean pageContainsAlbums(URL url) {
|
||||||
Pattern p = Pattern.compile("^https?://[\\w\\w.]*xhamster\\.com/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
Pattern p = Pattern.compile("^https?://[\\w\\w.]*xhamster([^<]*)\\.(com|one|desi)/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
LOGGER.info("Checking if page has albums");
|
LOGGER.info("Checking if page has albums");
|
||||||
LOGGER.info(m.matches());
|
LOGGER.info(m.matches());
|
||||||
@@ -113,17 +112,17 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRip(URL url) {
|
public boolean canRip(URL url) {
|
||||||
Pattern p = Pattern.compile("^https?://([\\w\\w]*\\.)?xhamster2?\\.(com|one|desi)/photos/gallery/.*?(\\d+)$");
|
Pattern p = Pattern.compile("^https?://([\\w\\w]*\\.)?xhamster([^<]*)\\.(com|one|desi)/photos/gallery/.*?(\\d+)$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://[\\w\\w.]*xhamster2?\\.(com|one|desi)/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
p = Pattern.compile("^https?://[\\w\\w.]*xhamster([^<]*)\\.(com|one|desi)/users/([a-zA-Z0-9_-]+)/(photos|videos)(/\\d+)?");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://.*xhamster2?\\.(com|one|desi)/(movies|videos)/.*$");
|
p = Pattern.compile("^https?://.*xhamster([^<]*)\\.(com|one|desi)/(movies|videos)/(.*$)");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return true;
|
return true;
|
||||||
@@ -132,7 +131,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVideoUrl(URL url) {
|
private boolean isVideoUrl(URL url) {
|
||||||
Pattern p = Pattern.compile("^https?://.*xhamster2?\\.(com|one|desi)/(movies|videos)/.*$");
|
Pattern p = Pattern.compile("^https?://.*xhamster([^<]*)\\.(com|one|desi)/(movies|videos)/(.*$)");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
return m.matches();
|
return m.matches();
|
||||||
}
|
}
|
||||||
@@ -142,8 +141,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
if (doc.select("a[rel=next]").first() != null) {
|
if (doc.select("a[rel=next]").first() != null) {
|
||||||
String nextPageUrl = doc.select("a[rel=next]").first().attr("href");
|
String nextPageUrl = doc.select("a[rel=next]").first().attr("href");
|
||||||
if (nextPageUrl.startsWith("http")) {
|
if (nextPageUrl.startsWith("http")) {
|
||||||
nextPageUrl = nextPageUrl.replaceAll("https?://\\w?\\w?\\.?xhamster\\.", "https://m.xhamster.");
|
nextPageUrl = nextPageUrl.replaceAll("https?://\\w?\\w?\\.?xhamster([^<]*)\\.", "https://m.xhamster$1.");
|
||||||
nextPageUrl = nextPageUrl.replaceAll("https?://xhamster2\\.", "https://m.xhamster2.");
|
|
||||||
return Http.url(nextPageUrl).get();
|
return Http.url(nextPageUrl).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,8 +163,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
try {
|
try {
|
||||||
// This works around some redirect fuckery xhamster likes to do where visiting m.xhamster.com sends to
|
// This works around some redirect fuckery xhamster likes to do where visiting m.xhamster.com sends to
|
||||||
// the page chamster.com but displays the mobile site from m.xhamster.com
|
// the page chamster.com but displays the mobile site from m.xhamster.com
|
||||||
pageWithImageUrl = pageWithImageUrl.replaceAll("://xhamster\\.", "://m.xhamster.");
|
pageWithImageUrl = pageWithImageUrl.replaceAll("://xhamster([^<]*)\\.", "://m.xhamster$1.");
|
||||||
pageWithImageUrl = pageWithImageUrl.replaceAll("://xhamster2\\.", "://m.xhamster.");
|
|
||||||
String image = Http.url(new URL(pageWithImageUrl)).get().select("a > img#photoCurr").attr("src");
|
String image = Http.url(new URL(pageWithImageUrl)).get().select("a > img#photoCurr").attr("src");
|
||||||
downloadFile(image);
|
downloadFile(image);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@@ -35,7 +35,7 @@ public class XhamsterRipperTest extends RippersTest {
|
|||||||
@Test
|
@Test
|
||||||
@Tag("flaky")
|
@Tag("flaky")
|
||||||
public void testXhamsterAlbumDesiDomain() throws IOException {
|
public void testXhamsterAlbumDesiDomain() throws IOException {
|
||||||
XhamsterRipper ripper = new XhamsterRipper(new URL("https://xhamster.desi/photos/gallery/japanese-dolls-4-asahi-mizuno-7254664"));
|
XhamsterRipper ripper = new XhamsterRipper(new URL("https://xhamster5.desi/photos/gallery/japanese-dolls-4-asahi-mizuno-7254664"));
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
@@ -49,9 +49,9 @@ public class XhamsterRipperTest extends RippersTest {
|
|||||||
XhamsterRipper ripper = new XhamsterRipper(new URL("https://pt.xhamster.com/photos/gallery/silvana-7105696"));
|
XhamsterRipper ripper = new XhamsterRipper(new URL("https://pt.xhamster.com/photos/gallery/silvana-7105696"));
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
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://xhamster5.desi/photos/gallery/japanese-dolls-4-asahi-mizuno-7254664");
|
||||||
XhamsterRipper ripper = new XhamsterRipper(url);
|
XhamsterRipper ripper = new XhamsterRipper(url);
|
||||||
Assertions.assertEquals("7254664", ripper.getGID(url));
|
Assertions.assertEquals("7254664", ripper.getGID(url));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user