Last active
December 15, 2021 01:30
-
-
Save capung-ggwp/0e621322b026f45043860dfc3a851c60 to your computer and use it in GitHub Desktop.
App Script example for Google Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example on sheet https://res.cloudinary.com/capung-ggwp/image/upload/v1639101873/ss_example_sheet_vs929r.png | |
function getProfile(username) { | |
const url = 'https://instagram-profile1.p.rapidapi.com/getprofile/'+username | |
const options = { | |
'method' : 'get', | |
'headers': { | |
'x-rapidapi-host': 'REPLACE_IT_X_RAPIDAPI_HOST', | |
'x-rapidapi-key': 'REPLACE_IT_X_RAPIDAPI_KEY' | |
} | |
}; | |
const profile = UrlFetchApp.fetch(url, options) | |
const profileJSON = JSON.parse(profile.getContentText()) | |
const last3Media = profileJSON.lastMedia.media.slice(0, 3) | |
profileJSON.lastMedia.media = last3Media | |
return JSON.stringify(profileJSON) | |
} | |
function getFollowers(rawJSON){ | |
const profileJSON = JSON.parse(rawJSON) | |
const followers = profileJSON.followers | |
return followers | |
} | |
function getBio(rawJSON) { | |
const profileJSON = JSON.parse(rawJSON) | |
const bio = profileJSON.bio | |
return bio | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment