Thanks to a HTTP call not very official, I find media ID, image URL, and user name of Instagram posts.
But I need the URL of each post on Instagram, and I don't know how to find it.
Is there an URL like instagram.com/something/{mediaID}
which redirect to instagram.com/p/{mediaSlug}
, or another method to find slug by media ID (without using the official API of course!) ?
For example, I've got :
Unique number : 1238578393243739028_1408429375
Media ID : 1238578393243739028
User ID : 1408429375
And I would :
Thanks for your help !
Java Solution :
public static String getInstagramPostId(String mediaId) {
String postId = "";
try {
long id = Long.parseLong(mediaId.substring(0, mediaId.indexOf('_')));
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
while (id > 0) {
long remainder = (id % 64);
id = (id - remainder) / 64;
postId = alphabet.charAt((int)remainder) + postId;
}
} catch (Exception e) {
e.printStackTrace();
}
return postId;
}