Since no one has responded, I thought I'd post my short-term solution (until there's an API call for it). It's a messy result, but it's something I can work with for the time being.
$.get('http://api.glitch.com/simple/players.info',{ oauth_token: getParameterByName('access_token') },function(data) {
if(data.error != 'not_authenticated') {
player = data;
$('#main').append('Player Loaded');
$.get('scrape.php?url=http://www.glitch.com/profiles/'+player.player_tsid+'/upgrades/',function(data) {
$(data).find('.upgrade-name').each(function(i,v) {
upgrades.push({ name: $(v).children('a').html(), desc: $(v).siblings('.upgrade-desc').html() });
});
$('#main').append('Upgrades Loaded');
});
}
},'json');
scrape.php is a simple pass-through that avoids the limitations of cross-domain coding.
Posted 4 months ago by
Snarkbutt

|
Permalink
it is not possible right now with the API...
not sure what you are doing, but the website itself (everything in the domain *.glitch.com) has a limit of 3 calls per 3 seconds. that means that if you have 10 users at the same time, 7 will need to wait to get their upgrades list.
(maybe it was just for the example, but...) be careful of having a scrape.php hosted in your site that allows to specify the URL as a parameter... or anyone will be able to call any website from your server... maybe you can just pass the playertsid as a parameter, and the php file calculates the full URL
HTH
Posted 4 months ago by
UXRoot

|
Permalink