Merge pull request #3 from kevin51jiang/VscoRip

Improved Docs & Code Fixes
This commit is contained in:
Kevin Jiang 2018-01-16 17:59:55 -05:00 committed by GitHub
commit dc5d65908d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 13 deletions

View File

@ -7,10 +7,7 @@ import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@ -20,7 +17,7 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
/** /**
* For ripping VSCO members' pages. * For ripping VSCO pictures.
*/ */
public class VscoRipper extends AbstractHTMLRipper{ public class VscoRipper extends AbstractHTMLRipper{
@ -31,6 +28,12 @@ public class VscoRipper extends AbstractHTMLRipper{
super(url); super(url);
} }
/**
* Checks to see if VscoRipper can Rip specified url.
* @param url
* @return True if can rip.
* False if cannot rip.
*/
@Override @Override
public boolean canRip(URL url) { public boolean canRip(URL url) {
if (!url.getHost().endsWith(DOMAIN)) { if (!url.getHost().endsWith(DOMAIN)) {
@ -44,7 +47,7 @@ public class VscoRipper extends AbstractHTMLRipper{
!u.contains("/feed/") || !u.contains("/feed/") ||
!u.contains("/login/") || !u.contains("/login/") ||
!u.contains("/journal/") || !u.contains("/journal/") ||
!u.contains("/collection")|| !u.contains("/collection/")||
!u.contains("/images/") || !u.contains("/images/") ||
u.contains("/media/"); u.contains("/media/");
@ -57,7 +60,8 @@ public class VscoRipper extends AbstractHTMLRipper{
} }
/** /**
* Recursion FTW * <p>Gets the direct URL of full-sized image through the <meta> tag.</p>
* When expanding future functionality (e.g. support from journals), put everything into this method.
* @param page * @param page
* @return * @return
*/ */

View File

@ -6,12 +6,19 @@ import java.net.URL;
public class VscoRipperTest extends RippersTest { public class VscoRipperTest extends RippersTest {
/**
* Testing Rip.
* @throws IOException
*/
public void testSingleImageRip() throws IOException{ public void testSingleImageRip() throws IOException{
VscoRipper ripper = new VscoRipper(new URL("https://vsco.co/minijello/media/571cd612542220261a123441")); VscoRipper ripper = new VscoRipper(new URL("https://vsco.co/minijello/media/571cd612542220261a123441"));
testRipper(ripper); 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"); URL url = new URL("https://vsco.co/minijello/media/571cd612542220261a123441");