SolvedMuledump Server Error

Posts 1–6 of 6 · Page 1 of 1
Muledump Server Error
Ever since a few days ago I keep getting this error in muledump

loading data
server error
full response:{"count":0,"created":"2016-10-08T21:11:52Z","lang":"en-US","results":null}

Any help would be greatly appreciated, thank you.
How am I supposed to fix this?
Quote Originally Posted by defound View Post
How am I supposed to fix this?
I don't know, I was working on a fix that got yahoo api queries out of the question but I don't know enough javascript/jquery to finish it. If anyone wants to take a look, the code that does this is in muledump/lib/realmapi.js, in the realmAPI function.

Code:
function realmAPI(path, opts, extraopts, callback) {
	opts.ignore = Math.floor(1e3 + 9e3 * Math.random())
	var url = BASEURL + path + '?' + $.param(opts)

	if (typeof extraopts == 'function') {
		callback = extraopts
		extraopts = {}
	}

	if (extraopts.iframe) {
		var ifr = document.createElement('iframe')
		ifr.style.display = 'none'
		document.body.appendChild(ifr)
		$(ifr).load(function() {
			$(this).remove()
			if (typeof callback == 'function') callback()
		})
		ifr.src = url
		return
	}

	/*queue_request({ //this is the normal function
		dataType: 'jsonp',
		url: 'https://query.yahooapis.com/v1/public/yql',
		data: {
			q: 'select * from xml where url="' + url + '"',
			format: 'json'
		},
		complete: callback
	})*/
	queue_request({ //what I added which doesn't work
		url: url,
		complete: function(result){
			var xmlresult = xmlToJson(result);
			return xmlresult;
		}
	});
}


//this was copypasted from some blogpost online
function xmlToJson(xml) {
	// Create the return object
	var obj = {};

	if (xml.nodeType == 1) { // element
		// do attributes
		if (xml.attributes.length > 0) {
		obj["@attributes"] = {};
			for (var j = 0; j < xml.attributes.length; j++) {
				var attribute = xml.attributes.item(j);
				obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
			}
		}
	} else if (xml.nodeType == 3) { // text
		obj = xml.nodeValue;
	}

	// do children
	if (xml.hasChildNodes()) {
		for(var i = 0; i < xml.childNodes.length; i++) {
			var item = xml.childNodes.item(i);
			var nodeName = item.nodeName;
			if (typeof(obj[nodeName]) == "undefined") {
				obj[nodeName] = xmlToJson(item);
			} else {
				if (typeof(obj[nodeName].push) == "undefined") {
					var old = obj[nodeName];
					obj[nodeName] = [];
					obj[nodeName].push(old);
				}
				obj[nodeName].push(xmlToJson(item));
			}
		}
	}
	return obj;
};
I couldn't figure out how to get the text data of the result, it was just a js [object Object].
I have the same problem!
So I've been working on this and I've run into a problem. It seems the url for realm:
Code:
var BASEURL = [
	'https://realmofthemadgodhrd.appspot.com/',
	'https://rotmgtesting.appspot.com/'
][+!!window.testing]
Has a CORS header missing that prevents you from locally getting it (Access-Control-Allow-Origin). The reason it works with the yahoo API is because it's loading from a web resource, not a local resource.

I have a third party API that handles things like this (and I don't see the problem since we're already using one that's yahoo) and I'll be incorporating this github repo to do the converting of xml to json. If you're curious, I'm going to use http://crossorigin.me/ for the loading.

- - - Updated - - -

Well I ended up using Cors-Anywhere instead, but when I format it to json the response text is a tad bit different. So for some reason, I get all the data in the same structure, just without the response shit that tells the function that it was a successful XHR request. I'll work more on this later, but I'd appreciate if anyone else could help me out with it.

- - - Updated - - -

Okay I've made a pull request to atomizer's repository. I hacked that together rather quickly, so please review it before accepting it as the ultimate fix.
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?