Skip to content

Instantly share code, notes, and snippets.

@ahmic
Created July 8, 2020 15:51
Show Gist options
  • Save ahmic/ab4cd2e0cca4871afbf1ce323e6f82ad to your computer and use it in GitHub Desktop.
Save ahmic/ab4cd2e0cca4871afbf1ce323e6f82ad to your computer and use it in GitHub Desktop.
-- change this to yours Instagram username
set userName to "ahmic.jpg"
set jsonData to do shell script "curl -s 'https://www.instagram.com/" & userName & "/?__a=1'"
set AppleScript's text item delimiters to {","}
set keyValueList to (every text item in jsonData) as list
set AppleScript's text item delimiters to ""
set followersItem to item 11 of keyValueList
set followersObject to RemoveFromString("\"", followersItem)
set followersObject to RemoveFromString("{", followersObject)
set followersObject to RemoveFromString("}", followersObject)
set AppleScript's text item delimiters to {":"}
set theKeyValueFollowers to (every text item in followersObject) as list
set num to item 3 of theKeyValueFollowers
return "🕵️ " & num
-- remove character or string from given string
on RemoveFromString(CharOrString, txt)
set AppleScript's text item delimiters to CharOrString
set temp to txt's text items
set AppleScript's text item delimiters to ""
return temp as text
end RemoveFromString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment