From 39a9edd1fa68b921b5e8659330046403221e2a60 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Fri, 6 Feb 2015 14:00:06 -0800 Subject: [PATCH] Support for DrawChan.net --- .../com/rarchives/ripme/ripper/rippers/ChanRipper.java | 7 +++++++ .../rarchives/ripme/tst/ripper/rippers/ChanRipperTest.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ChanRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ChanRipper.java index 0147e30d..f9ce7c17 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ChanRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ChanRipper.java @@ -87,6 +87,13 @@ public class ChanRipper extends AbstractHTMLRipper { if (m.matches()) { return m.group(2); } + + // Drawchan is weird, has drawchan.net/dc/dw/res/####.html + p = Pattern.compile("^.*\\.[a-z]{1,3}/[a-zA-Z0-9]+/[a-zA-Z0-9]+/res/([0-9]+)(\\.html|\\.php)?.*$"); + m = p.matcher(u); + if (m.matches()) { + return m.group(1); + } } throw new MalformedURLException( 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 eb754361..6967f902 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 @@ -34,6 +34,7 @@ public class ChanRipperTest extends RippersTest { passURLs.add(new URL("http://unichan2.org/b/res/518004.html")); passURLs.add(new URL("http://xchan.pw/porn/res/437.html")); passURLs.add(new URL("http://archive.moe/c/thread/2295132/")); + passURLs.add(new URL("http://drawchan.net/dc/dw/res/114910.html")); for (URL url : passURLs) { ChanRipper ripper = new ChanRipper(url); ripper.setup(); @@ -50,6 +51,7 @@ public class ChanRipperTest extends RippersTest { contentURLs.add(new URL("http://desuchan.net/v/res/7034.html")); contentURLs.add(new URL("http://boards.420chan.org/ana/res/75984.php")); contentURLs.add(new URL("http://archive.4plebs.org/s4s/thread/3005257/")); + contentURLs.add(new URL("http://drawchan.net/dc/dw/res/114910.html")); // Most *chans have volatile threads & can't be trusted for integration testing.