I have a code in Google Apps Scripts that takes a Spotify URL and pastes the amount of followers in the cell where you reference the url. =SAMPLE(A2) (where A2 holds the URL)
It seems that the specification has changed again. And I'm not sure how to fix it. Any guidance or help would be greatly appreciated!
Here's the original post = FetchingURL Using JSON on Google Sheets
Here's the code I have currently in Google Apps Scripts. (courtesy of @Tanaike)
function SAMPLE(url) {
const res = UrlFetchApp.fetch(url).getContentText();
const v = res.match(/"followers":({[\s\S\w]+?})/);
return v && v.length == 2 ? JSON.parse(v[1].trim()).total : "Value cannot be
retrieved.";
}
Thanks!