1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-21 13:11:27 +02:00

new URI instead of new URL in tests, 10.

This commit is contained in:
soloturn
2023-06-13 07:43:41 +02:00
parent 874c565c56
commit 589d7eb5a5
9 changed files with 93 additions and 77 deletions

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.PornhubRipper;
@@ -13,26 +15,26 @@ import org.junit.jupiter.api.Test;
public class PornhubRipperTest extends RippersTest {
@Test
public void testPornhubRip() throws IOException {
public void testPornhubRip() throws IOException, URISyntaxException {
if (Utils.getConfigBoolean("test.run_flaky_tests", false)) {
PornhubRipper ripper = new PornhubRipper(new URL("https://www.pornhub.com/album/15680522"));
PornhubRipper ripper = new PornhubRipper(new URI("https://www.pornhub.com/album/15680522").toURL());
testRipper(ripper);
}
}
public void testGetGID() throws IOException {
URL url = new URL("https://www.pornhub.com/album/15680522?page=2");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("https://www.pornhub.com/album/15680522?page=2").toURL();
PornhubRipper ripper = new PornhubRipper(url);
Assertions.assertEquals("15680522", ripper.getGID(url));
url = new URL("https://www.pornhub.com/album/15680522");
url = new URI("https://www.pornhub.com/album/15680522").toURL();
Assertions.assertEquals("15680522", ripper.getGID(url));
}
@Test
@Tag("flaky")
public void testGetNextPage() throws IOException {
public void testGetNextPage() throws IOException, URISyntaxException {
String baseURL = "https://www.pornhub.com/album/30687901";
PornhubRipper ripper = new PornhubRipper(new URL(baseURL));
PornhubRipper ripper = new PornhubRipper(new URI(baseURL).toURL());
Document page = Http.url(baseURL).get();
int numPagesRemaining = 1;
for (int idx = 0; idx < numPagesRemaining; idx++){

View File

@@ -2,7 +2,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import com.rarchives.ripme.ripper.rippers.RedditRipper;
@@ -14,23 +15,23 @@ public class RedditRipperTest extends RippersTest {
@Test
@Tag("flaky") // https://github.com/RipMeApp/ripme/issues/253
public void testRedditSubredditRip() throws IOException {
RedditRipper ripper = new RedditRipper(new URL("http://www.reddit.com/r/nsfw_oc"));
public void testRedditSubredditRip() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(new URI("http://www.reddit.com/r/nsfw_oc").toURL());
testRipper(ripper);
}
@Test
@Tag("flaky") // https://github.com/RipMeApp/ripme/issues/253
public void testRedditSubredditTopRip() throws IOException {
RedditRipper ripper = new RedditRipper(new URL("http://www.reddit.com/r/nsfw_oc/top?t=all"));
public void testRedditSubredditTopRip() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(new URI("http://www.reddit.com/r/nsfw_oc/top?t=all").toURL());
testRipper(ripper);
}
@Test
@Disabled
public void testRedditPostRip() throws IOException {
public void testRedditPostRip() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/"));
new URI("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/").toURL());
testRipper(ripper);
}
@@ -41,25 +42,25 @@ public class RedditRipperTest extends RippersTest {
*/
@Test
@Tag("flaky")
public void testRedditGfyGoodURL() throws IOException {
public void testRedditGfyGoodURL() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("https://www.reddit.com/r/bottesting/comments/7msozf/good_link/"));
new URI("https://www.reddit.com/r/bottesting/comments/7msozf/good_link/").toURL());
testRipper(ripper);
}
@Test
@Tag("flaky")
public void testSelfPostRip() throws IOException {
public void testSelfPostRip() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("https://www.reddit.com/r/gonewildstories/comments/oz7d97/f_18_finally_having_a_normal_sex_life/")
new URI("https://www.reddit.com/r/gonewildstories/comments/oz7d97/f_18_finally_having_a_normal_sex_life/").toURL()
);
testRipper(ripper);
}
@Test
@Tag("flaky")
public void testSelfPostAuthorRip() throws IOException {
RedditRipper ripper = new RedditRipper(new URL("https://www.reddit.com/user/ickybabie_"));
public void testSelfPostAuthorRip() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(new URI("https://www.reddit.com/user/ickybabie_").toURL());
testRipper(ripper);
}
@@ -70,9 +71,9 @@ public class RedditRipperTest extends RippersTest {
*/
@Test
@Tag("flaky")
public void testRedditGfyBadURL() throws IOException {
public void testRedditGfyBadURL() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("https://www.reddit.com/r/bottesting/comments/7msmhi/bad_link/"));
new URI("https://www.reddit.com/r/bottesting/comments/7msmhi/bad_link/").toURL());
testRipper(ripper);
}
@@ -82,16 +83,16 @@ public class RedditRipperTest extends RippersTest {
* @throws IOException
*/
@Test
public void testRedditGfycatRedirectURL() throws IOException {
public void testRedditGfycatRedirectURL() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("https://www.reddit.com/r/NSFW_GIF/comments/ennwsa/gorgeous_tits/"));
new URI("https://www.reddit.com/r/NSFW_GIF/comments/ennwsa/gorgeous_tits/").toURL());
}
@Test
@Tag("flaky")
public void testRedditGallery() throws IOException{
public void testRedditGallery() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(
new URL("https://www.reddit.com/gallery/hrrh23"));
new URI("https://www.reddit.com/gallery/hrrh23").toURL());
testRipper(ripper);
}
}

View File

@@ -6,7 +6,8 @@ import org.jsoup.nodes.Document;
import org.junit.jupiter.api.*;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
public class RedgifsRipperTest extends RippersTest {
@@ -15,8 +16,8 @@ public class RedgifsRipperTest extends RippersTest {
*/
@Test
@Disabled("test or ripper broken")
public void testRedgifsGoodURL() throws IOException{
RedgifsRipper ripper = new RedgifsRipper(new URL("https://www.redgifs.com/watch/talkativewarpeddragon-petite"));
public void testRedgifsGoodURL() throws IOException, URISyntaxException {
RedgifsRipper ripper = new RedgifsRipper(new URI("https://www.redgifs.com/watch/talkativewarpeddragon-petite").toURL());
testRipper(ripper);
}
@@ -25,8 +26,8 @@ public class RedgifsRipperTest extends RippersTest {
*/
@Test
@Tag("flaky")
public void testRedgifsBadRL() throws IOException{
RedgifsRipper ripper = new RedgifsRipper(new URL("https://www.gifdeliverynetwork.com/foolishelasticchimpanzee"));
public void testRedgifsBadRL() throws IOException, URISyntaxException {
RedgifsRipper ripper = new RedgifsRipper(new URI("https://www.gifdeliverynetwork.com/foolishelasticchimpanzee").toURL());
testRipper(ripper);
}
@@ -35,8 +36,8 @@ public class RedgifsRipperTest extends RippersTest {
*/
@Test
@Tag("flaky")
public void testRedgifsProfile() throws IOException {
RedgifsRipper ripper = new RedgifsRipper(new URL("https://redgifs.com/users/margo_monty"));
public void testRedgifsProfile() throws IOException, URISyntaxException {
RedgifsRipper ripper = new RedgifsRipper(new URI("https://redgifs.com/users/margo_monty").toURL());
testRipper(ripper);
}
@@ -46,8 +47,8 @@ public class RedgifsRipperTest extends RippersTest {
*/
@Test
@Disabled("test or ripper broken")
public void testRedgifsSearch() throws IOException {
RedgifsRipper ripper = new RedgifsRipper(new URL("https://redgifs.com/gifs/browse/little-caprice"));
public void testRedgifsSearch() throws IOException, URISyntaxException {
RedgifsRipper ripper = new RedgifsRipper(new URI("https://redgifs.com/gifs/browse/little-caprice").toURL());
Document doc = ripper.getFirstPage();
doc = ripper.getNextPage(doc);
@@ -58,8 +59,8 @@ public class RedgifsRipperTest extends RippersTest {
@Test
@Tag("flaky")
public void testRedditRedgifs() throws IOException {
RedditRipper ripper = new RedditRipper(new URL("https://www.reddit.com/r/nsfwhardcore/comments/ouz5bw/me_cumming_on_his_face/"));
public void testRedditRedgifs() throws IOException, URISyntaxException {
RedditRipper ripper = new RedditRipper(new URI("https://www.reddit.com/r/nsfwhardcore/comments/ouz5bw/me_cumming_on_his_face/").toURL());
testRipper(ripper);
}
}

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.Rule34Ripper;
@@ -9,14 +11,14 @@ import org.junit.jupiter.api.Test;
public class Rule34RipperTest extends RippersTest {
@Test
public void testShesFreakyRip() throws IOException {
Rule34Ripper ripper = new Rule34Ripper(new URL("https://rule34.xxx/index.php?page=post&s=list&tags=bimbo"));
public void testShesFreakyRip() throws IOException, URISyntaxException {
Rule34Ripper ripper = new Rule34Ripper(new URI("https://rule34.xxx/index.php?page=post&s=list&tags=bimbo").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("https://rule34.xxx/index.php?page=post&s=list&tags=bimbo");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("https://rule34.xxx/index.php?page=post&s=list&tags=bimbo").toURL();
Rule34Ripper ripper = new Rule34Ripper(url);
Assertions.assertEquals("bimbo", ripper.getGID(url));
}

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.RulePornRipper;
@@ -9,14 +11,14 @@ import org.junit.jupiter.api.Test;
public class RulePornRipperTest extends RippersTest {
@Test
public void testRip() throws IOException {
RulePornRipper ripper = new RulePornRipper(new URL("https://ruleporn.com/tosh/"));
public void testRip() throws IOException, URISyntaxException {
RulePornRipper ripper = new RulePornRipper(new URI("https://ruleporn.com/tosh/").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("https://ruleporn.com/tosh/");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("https://ruleporn.com/tosh/").toURL();
RulePornRipper ripper = new RulePornRipper(url);
Assertions.assertEquals("tosh", ripper.getGID(url));
}

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.SankakuComplexRipper;
@@ -12,30 +14,30 @@ import org.junit.jupiter.api.Test;
public class SankakuComplexRipperTest extends RippersTest {
@Test
@Disabled("https://github.com/RipMeApp/ripme/issues/257")
public void testSankakuChanRip() throws IOException {
public void testSankakuChanRip() throws IOException, URISyntaxException {
SankakuComplexRipper ripper = new SankakuComplexRipper(
new URL("https://chan.sankakucomplex.com/?tags=cleavage"));
new URI("https://chan.sankakucomplex.com/?tags=cleavage").toURL());
testRipper(ripper);
}
@Test
@Disabled("https://github.com/RipMeApp/ripme/issues/257")
public void testSankakuIdolRip() throws IOException {
public void testSankakuIdolRip() throws IOException, URISyntaxException {
SankakuComplexRipper ripper = new SankakuComplexRipper(
new URL("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29"));
new URI("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29").toURL());
testRipper(ripper);
}
@Test
public void testgetGID() throws IOException {
URL url = new URL("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29");
public void testgetGID() throws IOException, URISyntaxException {
URL url = new URI("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29").toURL();
SankakuComplexRipper ripper = new SankakuComplexRipper(url);
Assertions.assertEquals("idol._meme_(me!me!me!)_(cosplay)", ripper.getGID(url));
}
@Test
public void testgetSubDomain() throws IOException {
URL url = new URL("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29");
public void testgetSubDomain() throws IOException, URISyntaxException {
URL url = new URI("https://idol.sankakucomplex.com/?tags=meme_%28me%21me%21me%21%29_%28cosplay%29").toURL();
SankakuComplexRipper ripper = new SankakuComplexRipper(url);
Assertions.assertEquals("idol.", ripper.getSubDomain(url));
}

View File

@@ -5,19 +5,21 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class ScrolllerRipperTest extends RippersTest {
@Test
public void testScrolllerGID() throws IOException {
public void testScrolllerGID() throws IOException, URISyntaxException {
Map<URL, String> testURLs = new HashMap<>();
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp"), "CatsStandingUp");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=pictures"), "CatsStandingUp");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?sort=top&filter=pictures"), "CatsStandingUp");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=pictures&sort=top"), "CatsStandingUp");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp").toURL(), "CatsStandingUp");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=pictures").toURL(), "CatsStandingUp");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?sort=top&filter=pictures").toURL(), "CatsStandingUp");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=pictures&sort=top").toURL(), "CatsStandingUp");
for (URL url : testURLs.keySet()) {
ScrolllerRipper ripper = new ScrolllerRipper(url);
ripper.setup();
@@ -27,19 +29,19 @@ public class ScrolllerRipperTest extends RippersTest {
}
@Test
public void testScrolllerFilterRegex() throws IOException {
public void testScrolllerFilterRegex() throws IOException, URISyntaxException {
Map<URL, String> testURLs = new HashMap<>();
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp"), "NOFILTER");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=pictures"), "PICTURE");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=videos"), "VIDEO");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=albums"), "ALBUM");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?sort=top&filter=pictures"), "PICTURE");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?sort=top&filter=videos"), "VIDEO");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?sort=top&filter=albums"), "ALBUM");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=pictures&sort=top"), "PICTURE");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=videos&sort=top"), "VIDEO");
testURLs.put(new URL("https://scrolller.com/r/CatsStandingUp?filter=albums&sort=top"), "ALBUM");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp").toURL(), "NOFILTER");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=pictures").toURL(), "PICTURE");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=videos").toURL(), "VIDEO");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=albums").toURL(), "ALBUM");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?sort=top&filter=pictures").toURL(), "PICTURE");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?sort=top&filter=videos").toURL(), "VIDEO");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?sort=top&filter=albums").toURL(), "ALBUM");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=pictures&sort=top").toURL(), "PICTURE");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=videos&sort=top").toURL(), "VIDEO");
testURLs.put(new URI("https://scrolller.com/r/CatsStandingUp?filter=albums&sort=top").toURL(), "ALBUM");
for (URL url : testURLs.keySet()) {
ScrolllerRipper ripper = new ScrolllerRipper(url);
ripper.setup();

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.ShesFreakyRipper;
@@ -12,15 +14,15 @@ import org.junit.jupiter.api.Test;
public class ShesFreakyRipperTest extends RippersTest {
@Test
@Disabled("https://github.com/RipMeApp/ripme/issues/254")
public void testShesFreakyRip() throws IOException {
public void testShesFreakyRip() throws IOException, URISyntaxException {
ShesFreakyRipper ripper = new ShesFreakyRipper(
new URL("http://www.shesfreaky.com/gallery/nicee-snow-bunny-579NbPjUcYa.html"));
new URI("http://www.shesfreaky.com/gallery/nicee-snow-bunny-579NbPjUcYa.html").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("http://www.shesfreaky.com/gallery/nicee-snow-bunny-579NbPjUcYa.html");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("http://www.shesfreaky.com/gallery/nicee-snow-bunny-579NbPjUcYa.html").toURL();
ShesFreakyRipper ripper = new ShesFreakyRipper(url);
Assertions.assertEquals("nicee-snow-bunny-579NbPjUcYa", ripper.getGID(url));
}

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.TapasticRipper;
@@ -11,14 +13,14 @@ import org.junit.jupiter.api.Test;
public class TapasticRipperTest extends RippersTest {
@Test
@Disabled("ripper broken")
public void testTapasticRip() throws IOException {
TapasticRipper ripper = new TapasticRipper(new URL("https://tapas.io/series/TPIAG"));
public void testTapasticRip() throws IOException, URISyntaxException {
TapasticRipper ripper = new TapasticRipper(new URI("https://tapas.io/series/TPIAG").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("https://tapas.io/series/TPIAG");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("https://tapas.io/series/TPIAG").toURL();
TapasticRipper ripper = new TapasticRipper(url);
Assertions.assertEquals("series_ TPIAG", ripper.getGID(url));
}