Instagram ripper now handles urls with and without a trailing /

This commit is contained in:
cyian-1756 2017-11-18 09:07:25 -05:00
parent e8185aaf3e
commit bcf3f9d2a7

View File

@ -186,7 +186,12 @@ public class InstagramRipper extends AbstractHTMLRipper {
try { try {
// Sleep for a while to avoid a ban // Sleep for a while to avoid a ban
sleep(2500); sleep(2500);
if (url.toExternalForm().substring(url.toExternalForm().length() - 1).equals("/")) {
getURLsFromPage(Http.url(url.toExternalForm() + "?max_id=" + nextPageID).get()); getURLsFromPage(Http.url(url.toExternalForm() + "?max_id=" + nextPageID).get());
} else {
getURLsFromPage(Http.url(url.toExternalForm() + "/?max_id=" + nextPageID).get());
}
} catch (IOException e) { } catch (IOException e) {
return imageURLs; return imageURLs;
} }
@ -199,6 +204,8 @@ public class InstagramRipper extends AbstractHTMLRipper {
} catch (IOException e) { } catch (IOException e) {
return imageURLs; return imageURLs;
} }
} else {
logger.warn("Can't get net page");
} }
} else { // We're ripping from a single page } else { // We're ripping from a single page
logger.info("Ripping from single page"); logger.info("Ripping from single page");