Handle statigr.am URLs (for re-ripping)

This commit is contained in:
4pr0n 2014-04-21 23:03:40 -07:00
parent 749d0dfb87
commit 9ccbc8ac09

View File

@ -27,7 +27,8 @@ public class InstagramRipper extends AlbumRipper {
@Override @Override
public boolean canRip(URL url) { public boolean canRip(URL url) {
return url.getHost().endsWith(DOMAIN); return (url.getHost().endsWith(DOMAIN)
|| url.getHost().endsWith("statigr.am"));
} }
@Override @Override
@ -45,11 +46,16 @@ public class InstagramRipper extends AlbumRipper {
} }
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);
}
return new URL("http://statigr.am/" + m.group(1)); return new URL("http://statigr.am/" + m.group(1));
} }
p = Pattern.compile("^.*statigr.am/([a-zA-Z0-9\\-_]{3,}).*$");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return new URL("http://statigr.am/" + m.group(1));
}
throw new MalformedURLException("Expected username in URL (instagram.com/username and not " + url);
}
private URL getUserPageFromImage(URL url) throws IOException { private URL getUserPageFromImage(URL url) throws IOException {
Document doc = Jsoup.connect(url.toExternalForm()).get(); Document doc = Jsoup.connect(url.toExternalForm()).get();