Merge pull request #682 from kevin51jiang/master
VSCO member profile fix
This commit is contained in:
commit
17741899ae
@ -2,17 +2,14 @@ package com.rarchives.ripme.ripper.rippers;
|
|||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
@ -119,7 +116,7 @@ public class VscoRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getUserName() {
|
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());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
@ -170,7 +167,7 @@ public class VscoRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
result = givenURL;
|
result = givenURL;
|
||||||
LOGGER.debug("Found image URL: " + 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 {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
|
|
||||||
//Single Image
|
//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());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
|
||||||
if (m.matches()){
|
if (m.matches()){
|
||||||
@ -203,7 +200,7 @@ public class VscoRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Member profile (Usernames should all be different, so this should work.
|
//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());
|
m = p.matcher(url.toExternalForm());
|
||||||
|
|
||||||
if (m.matches()){
|
if (m.matches()){
|
||||||
|
@ -7,19 +7,38 @@ import java.net.URL;
|
|||||||
public class VscoRipperTest extends RippersTest {
|
public class VscoRipperTest extends RippersTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing Rip.
|
* Testing single image.
|
||||||
* @throws IOException
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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("https://vsco.co/jolly-roger/images/1"));
|
||||||
|
testRipper(ripper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure it names the folder something sensible.
|
* Make sure it names the folder something sensible.
|
||||||
* @throws IOException
|
* @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");
|
||||||
|
|
||||||
VscoRipper ripper = new VscoRipper(url);
|
VscoRipper ripper = new VscoRipper(url);
|
||||||
|
Loading…
Reference in New Issue
Block a user