I am attempting to use JSON to extract followers on Spotify Playlists. It seems like various playlists have different HTML data - which makes it complicated.
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.";
}
This worked for about a year, but the HTML specification keeps changing. Can anyone help? Thank you!
