Merge pull request #206 from lfaoanl/master

Update InstagramRipper.java
This commit is contained in:
4_pr0n 2015-05-22 20:12:46 -07:00
commit 4871142252

View File

@ -39,12 +39,12 @@ public class InstagramRipper extends AbstractJSONRipper {
public boolean canRip(URL url) { public boolean canRip(URL url) {
return (url.getHost().endsWith("instagram.com") return (url.getHost().endsWith("instagram.com")
|| url.getHost().endsWith("statigr.am") || url.getHost().endsWith("statigr.am")
|| url.getHost().endsWith("iconosquare.com")); || url.getHost().endsWith("iconosquare.com/user"));
} }
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://iconosquare.com/([a-zA-Z0-9\\-_.]{3,}).*$"); Pattern p = Pattern.compile("^https?://iconosquare.com/user/([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);
@ -68,17 +68,17 @@ public class InstagramRipper extends AbstractJSONRipper {
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()) {
return new URL("http://iconosquare.com/" + m.group(1)); return new URL("http://iconosquare.com/user/" + m.group(1));
} }
p = Pattern.compile("^.*iconosquare\\.com/([a-zA-Z0-9\\-_.]{3,}).*$"); p = Pattern.compile("^.*iconosquare\\.com/user/([a-zA-Z0-9\\-_.]{3,}).*$");
m = p.matcher(url.toExternalForm()); m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return new URL("http://iconosquare.com/" + m.group(1)); return new URL("http://iconosquare.com/user/" + m.group(1));
} }
p = Pattern.compile("^.*statigr\\.am/([a-zA-Z0-9\\-_.]{3,}).*$"); p = Pattern.compile("^.*statigr\\.am/([a-zA-Z0-9\\-_.]{3,}).*$");
m = p.matcher(url.toExternalForm()); m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return new URL("http://iconosquare.com/" + m.group(1)); return new URL("http://iconosquare.com/user/" + m.group(1));
} }
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);
} }