From 53e8a66e4c8cee1395bd6b84254bd8ba67ee96f6 Mon Sep 17 00:00:00 2001 From: soloturn Date: Mon, 12 Jun 2023 01:31:50 +0200 Subject: [PATCH] new URL(string) replaced with new URI(string).toURL(), as deprecated in java-20 --- .../ripper/rippers/AerisdiesRipperTest.java | 18 ++++++----- .../rippers/AllporncomicRipperTest.java | 7 +++-- .../ripper/rippers/ArtAlleyRipperTest.java | 7 +++-- .../ripper/rippers/ArtStationRipperTest.java | 18 ++++++----- .../tst/ripper/rippers/BaraagRipperTest.java | 7 +++-- .../tst/ripper/rippers/BatoRipperTest.java | 14 +++++---- .../tst/ripper/rippers/BcfakesRipperTest.java | 7 +++-- .../rippers/BlackbrickroadofozRipperTest.java | 7 +++-- .../tst/ripper/rippers/BooruRipperTest.java | 26 +++++++++------- .../tst/ripper/rippers/CfakeRipperTest.java | 7 +++-- .../tst/ripper/rippers/ChanRipperTest.java | 30 +++++++++--------- .../ripper/rippers/CheveretoRipperTest.java | 11 ++++--- .../ripper/rippers/ComicextraRipperTest.java | 10 +++--- .../ripper/rippers/CyberdropRipperTest.java | 14 +++++---- .../ripper/rippers/DanbooruRipperTest.java | 18 ++++++----- .../tst/ripper/rippers/E621RipperTest.java | 31 ++++++++++--------- 16 files changed, 126 insertions(+), 106 deletions(-) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AerisdiesRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AerisdiesRipperTest.java index a8fec2e7..4c0bd833 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AerisdiesRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AerisdiesRipperTest.java @@ -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.AerisdiesRipper; @@ -12,29 +14,29 @@ import org.junit.jupiter.api.Test; public class AerisdiesRipperTest extends RippersTest { @Test @Tag("flaky") - public void testAlbum() throws IOException { - AerisdiesRipper ripper = new AerisdiesRipper(new URL("http://www.aerisdies.com/html/lb/alb_1097_1.html")); + public void testAlbum() throws IOException, URISyntaxException { + AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/alb_1097_1.html").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testSubAlbum() throws IOException { - AerisdiesRipper ripper = new AerisdiesRipper(new URL("http://www.aerisdies.com/html/lb/alb_3692_1.html")); + public void testSubAlbum() throws IOException, URISyntaxException { + AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/alb_3692_1.html").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testDjAlbum() throws IOException { - AerisdiesRipper ripper = new AerisdiesRipper(new URL("http://www.aerisdies.com/html/lb/douj_5230_1.html")); + public void testDjAlbum() throws IOException, URISyntaxException { + AerisdiesRipper ripper = new AerisdiesRipper(new URI("http://www.aerisdies.com/html/lb/douj_5230_1.html").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testGetGID() throws IOException { - URL url = new URL("http://www.aerisdies.com/html/lb/douj_5230_1.html"); + public void testGetGID() throws IOException, URISyntaxException { + URL url = new URI("http://www.aerisdies.com/html/lb/douj_5230_1.html").toURL(); AerisdiesRipper ripper = new AerisdiesRipper(url); Assertions.assertEquals("5230", ripper.getGID(url)); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AllporncomicRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AllporncomicRipperTest.java index 41c9542a..20b79c0b 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AllporncomicRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/AllporncomicRipperTest.java @@ -5,13 +5,14 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; public class AllporncomicRipperTest extends RippersTest { @Test @Tag("flaky") - public void testAlbum() throws IOException { - AllporncomicRipper ripper = new AllporncomicRipper(new URL("https://allporncomic.com/porncomic/dnd-pvp-dungeons-dragons-fred-perry/1-dnd-pvp")); + public void testAlbum() throws IOException, URISyntaxException { + AllporncomicRipper ripper = new AllporncomicRipper(new URI("https://allporncomic.com/porncomic/dnd-pvp-dungeons-dragons-fred-perry/1-dnd-pvp").toURL()); testRipper(ripper); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtAlleyRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtAlleyRipperTest.java index 400e95c3..63b9d69b 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtAlleyRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtAlleyRipperTest.java @@ -1,7 +1,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.ArtAlleyRipper; import org.junit.jupiter.api.Disabled; @@ -10,8 +11,8 @@ import org.junit.jupiter.api.Test; public class ArtAlleyRipperTest extends RippersTest { @Test @Disabled("website switched off") - public void testRip() throws IOException { - ArtAlleyRipper ripper = new ArtAlleyRipper(new URL("https://artalley.social/@curator/media")); + public void testRip() throws IOException, URISyntaxException { + ArtAlleyRipper ripper = new ArtAlleyRipper(new URI("https://artalley.social/@curator/media").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtStationRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtStationRipperTest.java index e29a32ed..6450cad1 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtStationRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ArtStationRipperTest.java @@ -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 java.util.ArrayList; import java.util.List; @@ -14,11 +16,11 @@ public class ArtStationRipperTest extends RippersTest { @Test @Tag("flaky") - public void testArtStationProjects() throws IOException { + public void testArtStationProjects() throws IOException, URISyntaxException { List contentURLs = new ArrayList<>(); - contentURLs.add(new URL("https://www.artstation.com/artwork/the-dwarf-mortar")); - contentURLs.add(new URL("https://www.artstation.com/artwork/K36GR")); - contentURLs.add(new URL("http://artstation.com/artwork/5JJQw")); + contentURLs.add(new URI("https://www.artstation.com/artwork/the-dwarf-mortar").toURL()); + contentURLs.add(new URI("https://www.artstation.com/artwork/K36GR").toURL()); + contentURLs.add(new URI("http://artstation.com/artwork/5JJQw").toURL()); for (URL url : contentURLs) { ArtStationRipper ripper = new ArtStationRipper(url); testRipper(ripper); @@ -27,11 +29,11 @@ public class ArtStationRipperTest extends RippersTest { @Test @Tag("flaky") - public void testArtStationUserProfiles() throws IOException { + public void testArtStationUserProfiles() throws IOException, URISyntaxException { List contentURLs = new ArrayList<>(); - contentURLs.add(new URL("https://www.artstation.com/heitoramatsu")); - contentURLs.add(new URL("https://artstation.com/kuvshinov_ilya")); - contentURLs.add(new URL("http://artstation.com/givemeapiggy")); + contentURLs.add(new URI("https://www.artstation.com/heitoramatsu").toURL()); + contentURLs.add(new URI("https://artstation.com/kuvshinov_ilya").toURL()); + contentURLs.add(new URI("http://artstation.com/givemeapiggy").toURL()); for (URL url : contentURLs) { ArtStationRipper ripper = new ArtStationRipper(url); testRipper(ripper); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BaraagRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BaraagRipperTest.java index 5e71de70..7b987b74 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BaraagRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BaraagRipperTest.java @@ -1,7 +1,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.BaraagRipper; import org.junit.jupiter.api.Tag; @@ -10,8 +11,8 @@ import org.junit.jupiter.api.Test; public class BaraagRipperTest extends RippersTest { @Test @Tag("flaky") - public void testRip() throws IOException { - BaraagRipper ripper = new BaraagRipper(new URL("https://baraag.net/@darkshadow777/media")); + public void testRip() throws IOException, URISyntaxException { + BaraagRipper ripper = new BaraagRipper(new URI("https://baraag.net/@darkshadow777/media").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BatoRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BatoRipperTest.java index 3ceb2ac7..6849f0e1 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BatoRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BatoRipperTest.java @@ -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.BatoRipper; @@ -13,22 +15,22 @@ public class BatoRipperTest extends RippersTest { @Test @Disabled("cloudlare? gets unavailable in test but works in browser") - public void testRip() throws IOException { - BatoRipper ripper = new BatoRipper(new URL("https://bato.to/chapter/1207152")); + public void testRip() throws IOException, URISyntaxException { + BatoRipper ripper = new BatoRipper(new URI("https://bato.to/chapter/1207152").toURL()); testRipper(ripper); } @Test - public void testGetGID() throws IOException { - URL url = new URL("https://bato.to/chapter/1207152"); + public void testGetGID() throws IOException, URISyntaxException { + URL url = new URI("https://bato.to/chapter/1207152").toURL(); BatoRipper ripper = new BatoRipper(url); Assertions.assertEquals("1207152", ripper.getGID(url)); } @Test @Disabled("cloudlare? gets unavailable in test but works in browser") - public void testGetAlbumTitle() throws IOException { - URL url = new URL("https://bato.to/chapter/1207152"); + public void testGetAlbumTitle() throws IOException, URISyntaxException { + URL url = new URI("https://bato.to/chapter/1207152").toURL(); BatoRipper ripper = new BatoRipper(url); Assertions.assertEquals("bato_1207152_I_Messed_Up_by_Teaching_at_a_Black_Gyaru_School!_Ch.2", ripper.getAlbumTitle(url)); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BcfakesRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BcfakesRipperTest.java index 8c31ffd4..3140c056 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BcfakesRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BcfakesRipperTest.java @@ -1,7 +1,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.BcfakesRipper; @@ -11,8 +12,8 @@ import org.junit.jupiter.api.Test; public class BcfakesRipperTest extends RippersTest { @Test @Disabled("21/06/2018 This test was disbaled as the site has experienced notable downtime") - public void testRip() throws IOException { - BcfakesRipper ripper = new BcfakesRipper(new URL("http://www.bcfakes.com/celebritylist/olivia-wilde/")); + public void testRip() throws IOException, URISyntaxException { + BcfakesRipper ripper = new BcfakesRipper(new URI("http://www.bcfakes.com/celebritylist/olivia-wilde/").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BlackbrickroadofozRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BlackbrickroadofozRipperTest.java index 0bf11d58..c28cc52d 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BlackbrickroadofozRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BlackbrickroadofozRipperTest.java @@ -6,14 +6,15 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; public class BlackbrickroadofozRipperTest extends RippersTest { @Test @Disabled("Commented out on 02/04/2019 because the serve has been down for a while") - public void testRip() throws IOException { + public void testRip() throws IOException, URISyntaxException { BlackbrickroadofozRipper ripper = new BlackbrickroadofozRipper( - new URL("http://www.blackbrickroadofoz.com/comic/beginning")); + new URI("http://www.blackbrickroadofoz.com/comic/beginning").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java index 663418b4..89efef4e 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java @@ -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 java.util.ArrayList; import java.util.List; @@ -13,10 +15,10 @@ import org.junit.jupiter.api.Test; public class BooruRipperTest extends RippersTest { @Test @Tag("flaky") - public void testRip() throws IOException { + public void testRip() throws IOException, URISyntaxException { List passURLs = new ArrayList<>(); - passURLs.add(new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry")); - passURLs.add(new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears")); + passURLs.add(new URI("https://xbooru.com/index.php?page=post&s=list&tags=furry").toURL()); + passURLs.add(new URI("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears").toURL()); for (URL url : passURLs) { BooruRipper ripper = new BooruRipper(url); @@ -25,9 +27,9 @@ public class BooruRipperTest extends RippersTest { } @Test - public void testGetGID() throws IOException { - URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); - URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + public void testGetGID() throws IOException, URISyntaxException { + URL xbooruUrl = new URI("https://xbooru.com/index.php?page=post&s=list&tags=furry").toURL(); + URL gelbooruUrl = new URI("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears").toURL(); BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); @@ -37,9 +39,9 @@ public class BooruRipperTest extends RippersTest { } @Test - public void testGetDomain() throws IOException { - URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); - URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + public void testGetDomain() throws IOException, URISyntaxException { + URL xbooruUrl = new URI("https://xbooru.com/index.php?page=post&s=list&tags=furry").toURL(); + URL gelbooruUrl = new URI("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears").toURL(); BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); @@ -49,9 +51,9 @@ public class BooruRipperTest extends RippersTest { } @Test - public void testGetHost() throws IOException { - URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); - URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + public void testGetHost() throws IOException, URISyntaxException { + URL xbooruUrl = new URI("https://xbooru.com/index.php?page=post&s=list&tags=furry").toURL(); + URL gelbooruUrl = new URI("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears").toURL(); BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CfakeRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CfakeRipperTest.java index 3e6dad94..95f7ec2e 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CfakeRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CfakeRipperTest.java @@ -1,13 +1,14 @@ 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.CfakeRipper; public class CfakeRipperTest extends RippersTest { - public void testRip() throws IOException { - CfakeRipper ripper = new CfakeRipper(new URL("http://cfake.com/picture/Zooey_Deschanel/1264")); + public void testRip() throws IOException, URISyntaxException { + CfakeRipper ripper = new CfakeRipper(new URI("http://cfake.com/picture/Zooey_Deschanel/1264").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ChanRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ChanRipperTest.java index e7b285fc..078e366d 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ChanRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ChanRipperTest.java @@ -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 java.util.ArrayList; import java.util.Arrays; @@ -15,14 +17,14 @@ import org.junit.jupiter.api.Test; public class ChanRipperTest extends RippersTest { @Test - public void testChanURLPasses() throws IOException { + public void testChanURLPasses() throws IOException, URISyntaxException { List passURLs = new ArrayList<>(); // URLs that should work - passURLs.add(new URL("http://desuchan.net/v/res/7034.html")); - passURLs.add(new URL("https://boards.4chan.org/hr/thread/3015701")); - passURLs.add(new URL("https://boards.420chan.org/420/res/232066.php")); - passURLs.add(new URL("http://7chan.org/gif/res/25873.html")); - passURLs.add(new URL("https://rbt.asia/g/thread/70643087/")); //must work with TLDs with len of 4 + passURLs.add(new URI("http://desuchan.net/v/res/7034.html").toURL()); + passURLs.add(new URI("https://boards.4chan.org/hr/thread/3015701").toURL()); + passURLs.add(new URI("https://boards.420chan.org/420/res/232066.php").toURL()); + passURLs.add(new URI("http://7chan.org/gif/res/25873.html").toURL()); + passURLs.add(new URI("https://rbt.asia/g/thread/70643087/").toURL()); //must work with TLDs with len of 4 for (URL url : passURLs) { ChanRipper ripper = new ChanRipper(url); ripper.setup(); @@ -32,13 +34,13 @@ public class ChanRipperTest extends RippersTest { } } @Test - public void testChanStringParsing() throws IOException { + public void testChanStringParsing() throws IOException, URISyntaxException { List site1 = Arrays.asList("site1.com"); List site1Cdns = Arrays.asList("cnd1.site1.com", "cdn2.site2.biz"); List site2 = Arrays.asList("site2.co.uk"); List site2Cdns = Arrays.asList("cdn.site2.co.uk"); - ChanRipper ripper = new ChanRipper(new URL("http://desuchan.net/v/res/7034.html")); + ChanRipper ripper = new ChanRipper(new URI("http://desuchan.net/v/res/7034.html").toURL()); List chansFromConfig = ripper .getChansFromConfig("site1.com[cnd1.site1.com|cdn2.site2.biz],site2.co.uk[cdn.site2.co.uk]"); Assertions.assertEquals(chansFromConfig.get(0).getDomains(), site1); @@ -48,22 +50,18 @@ public class ChanRipperTest extends RippersTest { Assertions.assertEquals(chansFromConfig.get(1).getCdns(), site2Cdns); } @Test - public void testChanRipper() throws IOException { + public void testChanRipper() throws IOException, URISyntaxException { List contentURLs = new ArrayList<>(); - contentURLs.add(new URL(getRandomThreadDesuarchive())); + contentURLs.add(new URI(getRandomThreadDesuarchive()).toURL()); for (URL url : contentURLs) { ChanRipper ripper = new ChanRipper(url); testChanRipper(ripper); } } - /** - * - * @return String returns a url to a active desuarchive.org tread as a string - */ - public String getRandomThreadDesuarchive() { + public String getRandomThreadDesuarchive() throws URISyntaxException { try { - Document doc = Http.url(new URL("https://desuarchive.org/wsg/")).get(); + Document doc = Http.url(new URI("https://desuarchive.org/wsg/").toURL()).get(); return doc.select("div.post_data > a").first().attr("href"); } catch (IOException e) { e.printStackTrace(); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CheveretoRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CheveretoRipperTest.java index 5b233431..6d893527 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CheveretoRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CheveretoRipperTest.java @@ -1,7 +1,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.CheveretoRipper; import org.junit.jupiter.api.Tag; @@ -10,14 +11,14 @@ import org.junit.jupiter.api.Test; public class CheveretoRipperTest extends RippersTest { @Test @Tag("flaky") - public void testTagFox() throws IOException { - CheveretoRipper ripper = new CheveretoRipper(new URL("http://tag-fox.com/album/Thjb")); + public void testTagFox() throws IOException, URISyntaxException { + CheveretoRipper ripper = new CheveretoRipper(new URI("http://tag-fox.com/album/Thjb").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testSubdirAlbum() throws IOException { - CheveretoRipper ripper = new CheveretoRipper(new URL("https://kenzato.uk/booru/album/TnEc")); + public void testSubdirAlbum() throws IOException, URISyntaxException { + CheveretoRipper ripper = new CheveretoRipper(new URI("https://kenzato.uk/booru/album/TnEc").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ComicextraRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ComicextraRipperTest.java index 75c1f955..0a64487d 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ComicextraRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ComicextraRipperTest.java @@ -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.ComicextraRipper; import org.junit.jupiter.api.Disabled; @@ -10,15 +12,15 @@ import org.junit.jupiter.api.Test; public class ComicextraRipperTest extends RippersTest { @Test @Tag("flaky") - public void testComicUrl() throws IOException { - URL url = new URL("https://www.comicextra.com/comic/karma-police"); + public void testComicUrl() throws IOException, URISyntaxException { + URL url = new URI("https://www.comicextra.com/comic/karma-police").toURL(); ComicextraRipper ripper = new ComicextraRipper(url); testRipper(ripper); } @Test @Disabled("no images found error, broken ripper?") - public void testChapterUrl() throws IOException { - URL url = new URL("https://www.comicextra.com/v-for-vendetta/chapter-1"); + public void testChapterUrl() throws IOException, URISyntaxException { + URL url = new URI("https://www.comicextra.com/v-for-vendetta/chapter-1").toURL(); ComicextraRipper ripper = new ComicextraRipper(url); testRipper(ripper); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java index 847f2abf..17f0c8a6 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/CyberdropRipperTest.java @@ -8,6 +8,8 @@ import org.junit.jupiter.api.Tag; 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.ArrayList; import java.util.HashMap; @@ -16,11 +18,11 @@ import java.util.Map; public class CyberdropRipperTest extends RippersTest { @Test - public void testScrolllerGID() throws IOException { + public void testScrolllerGID() throws IOException, URISyntaxException { Map testURLs = new HashMap<>(); - testURLs.put(new URL("https://cyberdrop.me/a/n4umdBjw"), "n4umdBjw"); - testURLs.put(new URL("https://cyberdrop.me/a/iLtp4BjW"), "iLtp4BjW"); + testURLs.put(new URI("https://cyberdrop.me/a/n4umdBjw").toURL(), "n4umdBjw"); + testURLs.put(new URI("https://cyberdrop.me/a/iLtp4BjW").toURL(), "iLtp4BjW"); for (URL url : testURLs.keySet()) { CyberdropRipper ripper = new CyberdropRipper(url); ripper.setup(); @@ -31,11 +33,11 @@ public class CyberdropRipperTest extends RippersTest { @Test @Tag("flaky") - public void testCyberdropNumberOfFiles() throws IOException { + public void testCyberdropNumberOfFiles() throws IOException, URISyntaxException { List testURLs = new ArrayList(); - testURLs.add(new URL("https://cyberdrop.me/a/n4umdBjw")); - testURLs.add(new URL("https://cyberdrop.me/a/iLtp4BjW")); + testURLs.add(new URI("https://cyberdrop.me/a/n4umdBjw").toURL()); + testURLs.add(new URI("https://cyberdrop.me/a/iLtp4BjW").toURL()); for (URL url : testURLs) { Assertions.assertTrue(willDownloadAllFiles(url)); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DanbooruRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DanbooruRipperTest.java index de3c6b5e..dd6e7163 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DanbooruRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DanbooruRipperTest.java @@ -6,6 +6,8 @@ import org.junit.jupiter.api.Tag; 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.ArrayList; import java.util.List; @@ -13,10 +15,10 @@ import java.util.List; public class DanbooruRipperTest extends RippersTest { @Test @Tag("flaky") - public void testRip() throws IOException { + public void testRip() throws IOException, URISyntaxException { List passURLs = new ArrayList<>(); - passURLs.add(new URL("https://danbooru.donmai.us/posts?tags=brown_necktie")); - passURLs.add(new URL("https://danbooru.donmai.us/posts?page=1&tags=pink_sweater_vest")); + passURLs.add(new URI("https://danbooru.donmai.us/posts?tags=brown_necktie").toURL()); + passURLs.add(new URI("https://danbooru.donmai.us/posts?page=1&tags=pink_sweater_vest").toURL()); for (URL url : passURLs) { DanbooruRipper danbooruRipper = new DanbooruRipper(url); @@ -25,9 +27,9 @@ public class DanbooruRipperTest extends RippersTest { } @Test - public void testGetGID() throws IOException { - URL danBooruUrl = new URL("https://danbooru.donmai.us/posts?tags=brown_necktie"); - URL danBooruUrl2 = new URL("https://danbooru.donmai.us/posts?page=1&tags=pink_sweater_vest"); + public void testGetGID() throws IOException, URISyntaxException { + URL danBooruUrl = new URI("https://danbooru.donmai.us/posts?tags=brown_necktie").toURL(); + URL danBooruUrl2 = new URI("https://danbooru.donmai.us/posts?page=1&tags=pink_sweater_vest").toURL(); DanbooruRipper danbooruRipper = new DanbooruRipper(danBooruUrl); DanbooruRipper danbooruRipper2 = new DanbooruRipper(danBooruUrl2); @@ -37,8 +39,8 @@ public class DanbooruRipperTest extends RippersTest { } @Test - public void testGetHost() throws IOException { - URL danBooruUrl = new URL("https://danbooru.donmai.us/posts?tags=brown_necktie"); + public void testGetHost() throws IOException, URISyntaxException { + URL danBooruUrl = new URI("https://danbooru.donmai.us/posts?tags=brown_necktie").toURL(); DanbooruRipper danbooruRipper = new DanbooruRipper(danBooruUrl); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/E621RipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/E621RipperTest.java index 31ce2260..4859ade0 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/E621RipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/E621RipperTest.java @@ -1,7 +1,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.E621Ripper; import org.junit.jupiter.api.Assertions; @@ -9,20 +10,20 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; public class E621RipperTest extends RippersTest { - public void testRip() throws IOException { - E621Ripper ripper = new E621Ripper(new URL("https://e621.net/posts?tags=beach")); + public void testRip() throws IOException, URISyntaxException { + E621Ripper ripper = new E621Ripper(new URI("https://e621.net/posts?tags=beach").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testFlashOrWebm() throws IOException { - E621Ripper ripper = new E621Ripper(new URL("https://e621.net/posts?page=4&tags=gif+rating%3As+3d")); + public void testFlashOrWebm() throws IOException, URISyntaxException { + E621Ripper ripper = new E621Ripper(new URI("https://e621.net/posts?page=4&tags=gif+rating%3As+3d").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testGetNextPage() throws IOException { - E621Ripper nextPageRipper = new E621Ripper(new URL("https://e621.net/posts?tags=cosmicminerals")); + public void testGetNextPage() throws IOException, URISyntaxException { + E621Ripper nextPageRipper = new E621Ripper(new URI("https://e621.net/posts?tags=cosmicminerals").toURL()); try { nextPageRipper.getNextPage(nextPageRipper.getFirstPage()); assert (true); @@ -30,7 +31,7 @@ public class E621RipperTest extends RippersTest { throw e; } - E621Ripper noNextPageRipper = new E621Ripper(new URL("https://e621.net/post/index/1/cosmicminerals")); + E621Ripper noNextPageRipper = new E621Ripper(new URI("https://e621.net/post/index/1/cosmicminerals").toURL()); try { noNextPageRipper.getNextPage(noNextPageRipper.getFirstPage()); } catch (IOException e) { @@ -39,20 +40,20 @@ public class E621RipperTest extends RippersTest { } @Test @Tag("flaky") - public void testOldRip() throws IOException { - E621Ripper ripper = new E621Ripper(new URL("https://e621.net/post/index/1/beach")); + public void testOldRip() throws IOException, URISyntaxException { + E621Ripper ripper = new E621Ripper(new URI("https://e621.net/post/index/1/beach").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testOldFlashOrWebm() throws IOException { - E621Ripper ripper = new E621Ripper(new URL("https://e621.net/post/index/1/gif")); + public void testOldFlashOrWebm() throws IOException, URISyntaxException { + E621Ripper ripper = new E621Ripper(new URI("https://e621.net/post/index/1/gif").toURL()); testRipper(ripper); } @Test @Tag("flaky") - public void testOldGetNextPage() throws IOException { - E621Ripper nextPageRipper = new E621Ripper(new URL("https://e621.net/post/index/1/cosmicminerals")); + public void testOldGetNextPage() throws IOException, URISyntaxException { + E621Ripper nextPageRipper = new E621Ripper(new URI("https://e621.net/post/index/1/cosmicminerals").toURL()); try { nextPageRipper.getNextPage(nextPageRipper.getFirstPage()); assert (true); @@ -60,7 +61,7 @@ public class E621RipperTest extends RippersTest { throw e; } - E621Ripper noNextPageRipper = new E621Ripper(new URL("https://e621.net/post/index/1/cosmicminerals")); + E621Ripper noNextPageRipper = new E621Ripper(new URI("https://e621.net/post/index/1/cosmicminerals").toURL()); try { noNextPageRipper.getNextPage(noNextPageRipper.getFirstPage()); } catch (IOException e) {