From fd2ff087dd430b4f46b5fcb56ba1e35ffb8d2055 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Tue, 13 Mar 2018 20:41:55 -0400 Subject: [PATCH 1/3] Fixed instagram ripper --- .../ripme/ripper/rippers/InstagramRipper.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index ab44edfd..14f78cf2 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -212,7 +212,8 @@ public class InstagramRipper extends AbstractHTMLRipper { JSONArray datas = new JSONArray(); try { JSONArray profilePage = json.getJSONObject("entry_data").getJSONArray("ProfilePage"); - datas = profilePage.getJSONObject(0).getJSONObject("user").getJSONObject("media").getJSONArray("nodes"); + datas = profilePage.getJSONObject(0).getJSONObject("graphql").getJSONObject("user") + .getJSONObject("edge_owner_to_timeline_media").getJSONArray("edges"); } catch (JSONException e) { // Handle hashtag pages datas = json.getJSONObject("entry_data").getJSONArray("TagPage").getJSONObject(0) @@ -220,15 +221,16 @@ public class InstagramRipper extends AbstractHTMLRipper { } for (int i = 0; i < datas.length(); i++) { JSONObject data = (JSONObject) datas.get(i); - Long epoch = data.getLong("date"); + data = data.getJSONObject("node"); + Long epoch = data.getLong("taken_at_timestamp"); Instant instant = Instant.ofEpochSecond(epoch); 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(); + Document slideShowDoc = Http.url(new URL ("https://www.instagram.com/p/" + data.getString("shortcode"))).get(); List toAdd = getPostsFromSinglePage(slideShowDoc); for (int slideShowInt=0; slideShowInt Date: Tue, 13 Mar 2018 20:45:28 -0400 Subject: [PATCH 2/3] Ripper no longer supports tags --- .../ripme/ripper/rippers/InstagramRipper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index 14f78cf2..dbadf355 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -127,11 +127,11 @@ public class InstagramRipper extends AbstractHTMLRipper { return m.group(1); } - p = Pattern.compile("^https?://www.instagram.com/explore/tags/([^/]+)/?"); - m = p.matcher(url.toExternalForm()); - if (m.matches()) { - return m.group(1); - } +// p = Pattern.compile("^https?://www.instagram.com/explore/tags/([^/]+)/?"); +// m = p.matcher(url.toExternalForm()); +// if (m.matches()) { +// return m.group(1); +// } throw new MalformedURLException("Unable to find user in " + url); } From 7356a13da13cd6dac580aa34ce197a690284aa46 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Wed, 14 Mar 2018 12:35:03 -0400 Subject: [PATCH 3/3] Minor code clean up --- .../com/rarchives/ripme/ripper/rippers/InstagramRipper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index dbadf355..e78834ba 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -227,7 +227,7 @@ public class InstagramRipper extends AbstractHTMLRipper { 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("shortcode"))).get(); + Document slideShowDoc = Http.url(new URL("https://www.instagram.com/p/" + data.getString("shortcode"))).get(); List toAdd = getPostsFromSinglePage(slideShowDoc); for (int slideShowInt=0; slideShowInt