Get data from HTML

Hi guys,

I am trying to retrieve avatar image from Kongregate using this

You can see that there is avatar_url I really need, but I have no idea how to get exactly avatar_url.

So far I have this code: (Js)

function GetUserData (x) {
	var detailsUrl = String.Format("http://www.api.kongregate.com/api/user_info.json?username=" + x);
	var www = new WWW(detailsUrl);
	return www;
	var responseText = www.text; //returns the whole data
}

So far it only returns the whole unprocessed info.
I’ve seen one guy posted tutorial about this but I am using JavaScript and converting C# script didn’t work for me.

Hope you get what I’am saying.
Thanks in advance :slight_smile:

you probably need to replace ‘return’ with ‘yield’, but Im not sure as I dont use JavaScript

As I see that guy use JSON deserializer script from https://raw.github.com/gist/1411710/MiniJSON.cs (This link returns error for me, probably cos of it required to login at GitHub). You can also use this class from JavaScript, just dounload C# code and put it to the Standart Assets folder of your project.

That’s the problem. I can’t download that script. It returns me an error: “400: Invalid request”.

I get a 400 error for that url when I don’t supply a username. Make sure you’re passing the username to your function.

Also, don’t use String.format. You aren’t formatting anything.

Just:

var detailsUrl = "http://www.api.kongregate.com/api/user_info.json?username=" + x;