1.0.16 - Fixed bug for Instagram usernames with - and _ #7
This commit is contained in:
parent
abdf7a504c
commit
a1dd9bbd25
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<groupId>com.rarchives.ripme</groupId>
|
<groupId>com.rarchives.ripme</groupId>
|
||||||
<artifactId>ripme</artifactId>
|
<artifactId>ripme</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.15</version>
|
<version>1.0.16</version>
|
||||||
<name>ripme</name>
|
<name>ripme</name>
|
||||||
<url>http://rip.rarchives.com</url>
|
<url>http://rip.rarchives.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -32,7 +32,7 @@ public class InstagramRipper extends AbstractRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^https?://instagram\\.com/p/([a-zA-Z0-9]{1,}).*$");
|
Pattern p = Pattern.compile("^https?://instagram\\.com/p/([a-zA-Z0-9\\-_]{1,}).*$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
// Link to photo, not the user account
|
// Link to photo, not the user account
|
||||||
@ -43,7 +43,7 @@ public class InstagramRipper extends AbstractRipper {
|
|||||||
throw new MalformedURLException("Failed to retrieve user page from " + url);
|
throw new MalformedURLException("Failed to retrieve user page from " + url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^.*instagram.com/([a-zA-Z0-9]{3,}).*$");
|
p = Pattern.compile("^.*instagram.com/([a-zA-Z0-9\\-_]{3,}).*$");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new MalformedURLException("Expected username in URL (instagram.com/username and not " + url);
|
throw new MalformedURLException("Expected username in URL (instagram.com/username and not " + url);
|
||||||
@ -132,7 +132,7 @@ public class InstagramRipper extends AbstractRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^https?://statigr.am/([a-zA-Z0-9]{3,}).*$");
|
Pattern p = Pattern.compile("^https?://statigr.am/([a-zA-Z0-9\\-_]{3,}).*$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
|
@ -3,12 +3,26 @@ package com.rarchives.ripme.tst.ripper.rippers;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.InstagramRipper;
|
import com.rarchives.ripme.ripper.rippers.InstagramRipper;
|
||||||
|
|
||||||
public class InstagramRipperTest extends RippersTest {
|
public class InstagramRipperTest extends RippersTest {
|
||||||
|
|
||||||
|
public void testInstagramGID() throws IOException {
|
||||||
|
Map<URL, String> testURLs = new HashMap<URL, String>();
|
||||||
|
testURLs.put(new URL("http://instagram.com/Test_User"), "Test_User");
|
||||||
|
testURLs.put(new URL("http://instagram.com/_test_user_"), "_test_user_");
|
||||||
|
testURLs.put(new URL("http://instagram.com/-test-user-"), "-test-user-");
|
||||||
|
for (URL url : testURLs.keySet()) {
|
||||||
|
InstagramRipper ripper = new InstagramRipper(url);
|
||||||
|
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
||||||
|
deleteDir(ripper.getWorkingDir());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testInstagramAlbums() throws IOException {
|
public void testInstagramAlbums() throws IOException {
|
||||||
if (!DOWNLOAD_CONTENT) {
|
if (!DOWNLOAD_CONTENT) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user