From 8c8258825863a8364a0b363c020a459a23db0f4a Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sat, 9 Jun 2018 00:18:36 -0400 Subject: [PATCH 1/3] VSCO User Profile Fix Changed the regex slightly to include the "-" character. --- .../rarchives/ripme/ripper/rippers/VscoRipper.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/VscoRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/VscoRipper.java index 11cb6a73..5b23b8bd 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/VscoRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/VscoRipper.java @@ -2,17 +2,14 @@ package com.rarchives.ripme.ripper.rippers; import com.rarchives.ripme.ripper.AbstractHTMLRipper; import com.rarchives.ripme.utils.Http; - import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.json.JSONObject; import org.jsoup.Jsoup; - import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; @@ -119,7 +116,7 @@ public class VscoRipper extends AbstractHTMLRipper { } private String getUserName() { - Pattern p = Pattern.compile("^https?://vsco.co/([a-zA-Z0-9]+)/images/[0-9]+"); + Pattern p = Pattern.compile("^https?://vsco.co/([a-zA-Z0-9-]+)/images/[0-9]+"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { @@ -170,7 +167,7 @@ public class VscoRipper extends AbstractHTMLRipper { result = givenURL; LOGGER.debug("Found image URL: " + givenURL); - break;//immediatly stop after getting URL (there should only be 1 image to be downloaded) + break;//immediately stop after getting URL (there should only be 1 image to be downloaded) } } @@ -192,7 +189,7 @@ public class VscoRipper extends AbstractHTMLRipper { public String getGID(URL url) throws MalformedURLException { //Single Image - Pattern p = Pattern.compile("^https?://vsco\\.co/([a-zA-Z0-9]+)/media/([a-zA-Z0-9]+)"); + Pattern p = Pattern.compile("^https?://vsco\\.co/([a-zA-Z0-9-]+)/media/([a-zA-Z0-9]+)"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()){ @@ -203,7 +200,7 @@ public class VscoRipper extends AbstractHTMLRipper { } //Member profile (Usernames should all be different, so this should work. - p = Pattern.compile("^https?://vsco.co/([a-zA-Z0-9]+)/images/[0-9]+"); + p = Pattern.compile("^https?://vsco.co/([a-zA-Z0-9-]+)/images/[0-9]+"); m = p.matcher(url.toExternalForm()); if (m.matches()){ From b5ab5b9b9906ef04f379c719d77226466f65f3c1 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sat, 9 Jun 2018 00:27:01 -0400 Subject: [PATCH 2/3] VSCO Tests Added a few tests for VSCORipper --- .../tst/ripper/rippers/VscoRipperTest.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java index 435c9aaa..799b4d09 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java @@ -7,19 +7,38 @@ import java.net.URL; public class VscoRipperTest extends RippersTest { /** - * Testing Rip. + * Testing single image. * @throws IOException */ - public void testSingleImageRip() throws IOException{ + public void testSingleImageRip() throws IOException { VscoRipper ripper = new VscoRipper(new URL("https://vsco.co/minijello/media/571cd612542220261a123441")); testRipper(ripper); } + /** + * Tests profile rip. + * @throws IOException + */ + public void testProfileRip() throws IOException { + VscoRipper ripper = new VscoRipper(new URL("https://vsco.co/jonathangodoy/images/1")); + testRipper(ripper); + } + + /** + * Prevents Bug #679 from happening again. + * https://github.com/RipMeApp/ripme/issues/679 + * @throws IOException + */ + public void testHyphenatedRip() throws IOException { + VscoRipper ripper = new VscoRipper(new URL("")); + testRipper(ripper); + } + /** * Make sure it names the folder something sensible. * @throws IOException */ - public void testGetGID() throws IOException{ + public void testGetGID() throws IOException { URL url = new URL("https://vsco.co/minijello/media/571cd612542220261a123441"); VscoRipper ripper = new VscoRipper(url); From ca8bcb3675bbce9c7b018e6ef0983a8400708e6e Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sat, 9 Jun 2018 00:35:44 -0400 Subject: [PATCH 3/3] Forgot URL :D This is what Travis-CI is for. --- .../com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java index 799b4d09..32d084b2 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VscoRipperTest.java @@ -30,7 +30,7 @@ public class VscoRipperTest extends RippersTest { * @throws IOException */ public void testHyphenatedRip() throws IOException { - VscoRipper ripper = new VscoRipper(new URL("")); + VscoRipper ripper = new VscoRipper(new URL("https://vsco.co/jolly-roger/images/1")); testRipper(ripper); }