diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/MangadexRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/MangadexRipper.java index 8c6c92271..d7abccd4f 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/MangadexRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/MangadexRipper.java @@ -62,10 +62,10 @@ public String getGID(URL url) throws MalformedURLException { } private String getChapterID(String url) { - Pattern p = Pattern.compile("https://mangadex.org/chapter/([\\d]+)/([\\d+]?)"); + Pattern p = Pattern.compile("https://(www\\.)?mangadex\\.org/chapter/([\\d]+)/([\\d+]?)"); Matcher m = p.matcher(url); if (m.matches()) { - return m.group(1); + return m.group(3); } return null; } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/MangadexRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/MangadexRipperTest.java index 3bcec8c8f..2fb036057 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/MangadexRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/MangadexRipperTest.java @@ -1,10 +1,11 @@ package com.rarchives.ripme.tst.ripper.rippers; - import com.rarchives.ripme.ripper.rippers.MangadexRipper; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -19,9 +20,15 @@ public void testRip() throws IOException, URISyntaxException { @Test @Tag("flaky") - public void test2() throws IOException, URISyntaxException { + public void testRip2() throws IOException, URISyntaxException { MangadexRipper ripper = new MangadexRipper(new URI("https://mangadex.org/title/44625/this-croc-will-die-in-100-days").toURL()); testRipper(ripper); } + @Test + @Tag("flaky") + public void testAltUrlRip() throws IOException, URISyntaxException { + MangadexRipper ripper = new MangadexRipper(new URI("https://www.mangadex.org/chapter/804465/1").toURL()); + testRipper(ripper); + } }