Instagram ripper can now downloads slideshows when ripping user profiles

This commit is contained in:
cyian-1756 2017-11-22 18:28:00 -05:00
parent f6d58ee748
commit 2e5f8a99b9

View File

@ -212,7 +212,19 @@ public class InstagramRipper extends AbstractHTMLRipper {
Long epoch = data.getLong("date"); Long epoch = data.getLong("date");
Instant instant = Instant.ofEpochSecond(epoch); Instant instant = Instant.ofEpochSecond(epoch);
String image_date = DateTimeFormatter.ofPattern("yyyy_MM_dd_hh:mm_").format(ZonedDateTime.ofInstant(instant, ZoneOffset.UTC)); String image_date = DateTimeFormatter.ofPattern("yyyy_MM_dd_hh:mm_").format(ZonedDateTime.ofInstant(instant, ZoneOffset.UTC));
if (data.getString("__typename").equals("GraphSidecar")) {
try {
Document slideShowDoc = Http.url(new URL ("https://www.instagram.com/p/" + data.getString("code"))).get();
List<String> toAdd = getPostsFromSinglePage(slideShowDoc);
for (int slideShowInt=0; slideShowInt<toAdd.size(); slideShowInt++) {
addURLToDownload(new URL(toAdd.get(slideShowInt)));
}
} catch (MalformedURLException e) {
logger.error("Unable to download slide show, URL was malformed");
} catch (IOException e) {
logger.error("Unable to download slide show");
}
}
try { try {
if (!data.getBoolean("is_video")) { if (!data.getBoolean("is_video")) {
if (imageURLs.size() == 0) { if (imageURLs.size() == 0) {