var request = require('request');
var qs = require('querystring');
var api = global.api;


api.mal.list = function(req, res, next) {
	res.type('application/json');

	ContentList.fetch(req.params.user, req.params.type, function(err, list) {
		res.send(list);
	});

};


var ContentList = (function() {
	function ContentList() {}

	ContentList.fetch = function(user, type, callback) {

		request({
				url: 'http://myanimelist.net/malappinfo.php?u=' + user + "&status=all&type=" + type,
				headers: {
					'User-Agent': 'api-team-692e8861471e4de2fd84f6d91d1175c0'
				}
			},
			function(error, response, body) {
				if (!error && response.statusCode == 200) {
					callback(null, body);
				} else {
					callback(error, null);
				}
			})

	};


	return ContentList;
})();

// Export the module
if (typeof module !== 'undefined' && module.exports) {
	module.exports = ContentList;
}
@@ -82,16 +82,60 @@
 al.api;%0A
+parseString = require('xml2js').parseString;
 %0A%0Aapi.ma
@@ -693,24 +693,100 @@
 e == 200) %7B%0A
+%0A%09%09%09%09%09parseString(body, function(err, result) %7B%0A%09%09%09%09%09%09var items = result;%0A%0A%09
 %09%09%09%09%09callbac
@@ -797,14 +797,26 @@
 ll, 
-body);
+items);%0A%09%09%09%09%09%7D);%0A%0A
 %0A%09%09%09

Converted to JSON response