I’m new to HTTP requests, and have tried accessing Instagram users’ follower count using the getJSON function
import {getJSON} from 'wix-fetch';
async function setIGFollowers (instagramID) {
getJSON("https://www.instagram.com/" + instagramID + "/?__a=1")
.then(json => {
console.log(json);
let followers = json.graphql.user.edge_followed_by.count
$w("#text1").text = "Followers: " + followers
})
.catch(err => console.error(err))
}
It worked at first, but now overtime I try to run it again, the catch returns the error:
SyntaxError: The string did not match the expected pattern.
What could be the problem? What are the required string patterns for the getJSON function?
Important to Note: This code did work a few hours ago, and does still work at another function, getting YouTube channel subscriber counts, below:
async function setYTSubs (youtubeID) {
getJSON("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=" + youtubeID + "&key=[AUTH TOKEN]")
.then(json => {
let subs = json.items[0].statistics.subscriberCount
$w("#text2").text = "Subscribers: " + subs
})
}
Thank you for your time