From b760ed35c95a7039ce749f77babd59deb996c582 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Wed, 9 May 2018 10:34:39 -0400 Subject: [PATCH 1/2] Minor style changes of DeviantartRipper --- .../rarchives/ripme/ripper/rippers/DeviantartRipper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java index 4461188e..1b90be5c 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java @@ -43,14 +43,17 @@ public class DeviantartRipper extends AbstractHTMLRipper { public String getHost() { return "deviantart"; } + @Override public String getDomain() { return "deviantart.com"; } + @Override public boolean hasDescriptionSupport() { return true; } + @Override public URL sanitizeURL(URL url) throws MalformedURLException { String u = url.toExternalForm(); @@ -121,6 +124,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { .cookies(cookies) .get(); } + private String jsonToImage(Document page, String id) { Elements js = page.select("script[type=\"text/javascript\"]"); for (Element tag : js) { @@ -142,6 +146,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { } return null; } + @Override public List getURLsFromPage(Document page) { List imageURLs = new ArrayList<>(); @@ -192,6 +197,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { } return imageURLs; } + @Override public List getDescriptionsFromPage(Document page) { List textURLs = new ArrayList<>(); @@ -210,6 +216,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { } return textURLs; } + @Override public Document getNextPage(Document page) throws IOException { if (isThisATest()) { From de6f696bb2c91075991de7790d4e46f046ef800c Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Wed, 9 May 2018 10:35:04 -0400 Subject: [PATCH 2/2] Added test for getGID --- .../ripme/tst/ripper/rippers/DeviantartRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/FuraffinityRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/ImagevenueRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/ImgboxRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/PornhubRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/Rule34RipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/TheyiffgalleryRipperTest.java | 6 ++++++ .../ripme/tst/ripper/rippers/WebtoonsRipperTest.java | 6 ++++++ 9 files changed, 54 insertions(+) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java index a3fdfd81..a3e6a9c8 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java @@ -16,4 +16,10 @@ public class DeviantartRipperTest extends RippersTest { DeviantartRipper ripper = new DeviantartRipper(new URL("http://faterkcx.deviantart.com/gallery/")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("http://airgee.deviantart.com/gallery/"); + DeviantartRipper ripper = new DeviantartRipper(url); + assertEquals("airgee", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java index 4285993b..90d66ecd 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java @@ -10,4 +10,10 @@ public class FuraffinityRipperTest extends RippersTest { FuraffinityRipper ripper = new FuraffinityRipper(new URL("https://www.furaffinity.net/gallery/mustardgas/")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("https://www.furaffinity.net/gallery/mustardgas/"); + FuraffinityRipper ripper = new FuraffinityRipper(url); + assertEquals("mustardgas", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java index 6856eb06..e53c78e6 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java @@ -10,4 +10,10 @@ public class GfycatporntubeRipperTest extends RippersTest { GfycatporntubeRipper ripper = new GfycatporntubeRipper(new URL("https://gfycatporntube.com/blowjob-bunny-puts-on-a-show/")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("https://gfycatporntube.com/blowjob-bunny-puts-on-a-show/"); + GfycatporntubeRipper ripper = new GfycatporntubeRipper(url); + assertEquals("blowjob-bunny-puts-on-a-show", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImagevenueRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImagevenueRipperTest.java index 135a7b0a..90d76442 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImagevenueRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImagevenueRipperTest.java @@ -10,4 +10,10 @@ public class ImagevenueRipperTest extends RippersTest { ImagevenueRipper ripper = new ImagevenueRipper(new URL("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo"); + ImagevenueRipper ripper = new ImagevenueRipper(url); + assertEquals("gallery_1373818527696_191lo", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgboxRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgboxRipperTest.java index db8e1680..27ebdca2 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgboxRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgboxRipperTest.java @@ -10,4 +10,10 @@ public class ImgboxRipperTest extends RippersTest { ImgboxRipper ripper = new ImgboxRipper(new URL("https://imgbox.com/g/FJPF7t26FD")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("https://imgbox.com/g/FJPF7t26FD"); + ImgboxRipper ripper = new ImgboxRipper(url); + assertEquals("FJPF7t26FD", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/PornhubRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/PornhubRipperTest.java index 96685cbc..74bee8d9 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/PornhubRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/PornhubRipperTest.java @@ -10,4 +10,10 @@ public class PornhubRipperTest extends RippersTest { PornhubRipper ripper = new PornhubRipper(new URL("https://www.pornhub.com/album/15680522")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("https://www.pornhub.com/album/15680522"); + PornhubRipper ripper = new PornhubRipper(url); + assertEquals("15680522", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/Rule34RipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/Rule34RipperTest.java index cffc807d..4c63d66e 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/Rule34RipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/Rule34RipperTest.java @@ -11,4 +11,10 @@ public class Rule34RipperTest extends RippersTest { testRipper(ripper); } + public void testGetGID() throws IOException { + URL url = new URL("https://rule34.xxx/index.php?page=post&s=list&tags=bimbo"); + Rule34Ripper ripper = new Rule34Ripper(url); + assertEquals("bimbo", ripper.getGID(url)); + } + } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/TheyiffgalleryRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/TheyiffgalleryRipperTest.java index 3c7a8fbd..91fc0617 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/TheyiffgalleryRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/TheyiffgalleryRipperTest.java @@ -10,4 +10,10 @@ public class TheyiffgalleryRipperTest extends RippersTest { TheyiffgalleryRipper ripper = new TheyiffgalleryRipper(new URL("https://theyiffgallery.com/index?/category/4303")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("https://theyiffgallery.com/index?/category/4303"); + TheyiffgalleryRipper ripper = new TheyiffgalleryRipper(url); + assertEquals("4303", ripper.getGID(url)); + } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/WebtoonsRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/WebtoonsRipperTest.java index 4aa50d0a..16407ad7 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/WebtoonsRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/WebtoonsRipperTest.java @@ -15,4 +15,10 @@ public class WebtoonsRipperTest extends RippersTest { WebtoonsRipper ripper = new WebtoonsRipper(new URL("http://www.webtoons.com/en/drama/lookism/ep-145/viewer?title_no=1049&episode_no=145")); testRipper(ripper); } + + public void testGetGID() throws IOException { + URL url = new URL("http://www.webtoons.com/en/drama/my-boo/ep-33/viewer?title_no=1185&episode_no=33"); + WebtoonsRipper ripper = new WebtoonsRipper(url); + assertEquals("my-boo", ripper.getGID(url)); + } }