Skip to content

Instantly share code, notes, and snippets.

@bibhuticoder
Last active July 29, 2021 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibhuticoder/34cbf23995aff5691ba76d78f5337c77 to your computer and use it in GitHub Desktop.
Save bibhuticoder/34cbf23995aff5691ba76d78f5337c77 to your computer and use it in GitHub Desktop.
try {
let instaAccessToken = "XXXXXX"; // get from DB
let resp = await axios.get(`https://graph.instagram.com/me/media?fields=media_type,permalink,media_url&access_token=${instaAccessToken}`);
resp = resp.data;
let instaPhotos = resp.data.filter(d => d.media_type === "IMAGE").map(d => d.media_url);
// Got insta photos
} catch (e) {
console.log(e.response.data.error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment