Skip to content

Instantly share code, notes, and snippets.

@letswritetw
Created February 8, 2021 12:50
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 letswritetw/3b88ae47aedba3efdf779760f6f198ec to your computer and use it in GitHub Desktop.
Save letswritetw/3b88ae47aedba3efdf779760f6f198ec to your computer and use it in GitHub Desktop.
ig-oembed
const getToken = '部署完取得的網址';
const igUri = 'IG 貼文的網址';
const hideCaption = true; // 要不要隱藏描述,true 隱藏、false 不隱藏
fetch(getToken)
.then(response => response.json())
.then(response => response.access_token)
.then(token => {
fetch(`https://graph.facebook.com/v9.0/instagram_oembed?url=${igUri}&access_token=${token}&hidecaption=${hideCaption}`)
.then(response => response.json())
.then(response => {
console.log(response);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment