Skip to content

Instantly share code, notes, and snippets.

@anilshanbhag
Created December 12, 2018 04:36
Show Gist options
  • Save anilshanbhag/a948af55eea6abbd3ac160170a4638c8 to your computer and use it in GitHub Desktop.
Save anilshanbhag/a948af55eea6abbd3ac160170a4638c8 to your computer and use it in GitHub Desktop.
let hash = "QVFBUVVWNmxaTWIwZ0pWSVp6NWIwamFzMEEzOWlHZHRESjdZdkFISDdUZVJyYjgxeUNFM0h3OVNILVRhSDZLS3NZOGtUNUVma2wxZXpFTmxrYU5hMjg5Nw==";
while (true) {
const url = 'https://www.instagram.com/graphql/query/?query_hash=42323d64886122307be10013ad2dcc44&variables={"id":"2094987403","first":"50","after":"' + hash + '"}'
const response = await fetch(url);
const obj = await response.json();
obj.data.user.edge_owner_to_timeline_media.edges.forEach((x) => {
console.log(x.node.id, x.node.shortcode, x.node.taken_at_timestamp, x.node.edge_media_preview_like.count, x.node.edge_media_to_comment.count);
});
if (obj.data.user.edge_owner_to_timeline_media.page_info.has_next_page) {
hash = obj.data.user.edge_owner_to_timeline_media.page_info.end_cursor
} else {
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment