Greasy Fork is available in English.

Дискусии » Разработка

Can someone help me figure out how to get data from the XML?

§
Публикуван на: 20.07.2014

Can someone help me figure out how to get data from the XML?

Hi, I'm a novice programmer and I've been trying to get data from this XML file for a script request.
http://www.aptoide.com/webservices/getApkInfo/jphermans/net.dinglisch.android.taskerm/4.4/xml

I've tried a few methods I read online but they all seem somehow blocked.

Anyone want to give it a shot?

§
Публикуван на: 21.07.2014

Thank you. I didn't realize GM has that function.
I tried using the function built into JS but it didn't work. This one worked great.

§
Публикуван на: 15.12.2015
Hi, I'm a novice programmer and I've been trying to get data from this XML file for a script request.
http://www.aptoide.com/webservices/getApkInfo/jphermans/net.dinglisch.android.taskerm/4.4/xml

I've tried a few methods I read online but they all seem somehow blocked.

Anyone want to give it a shot?

Does this work for u?

GM_xmlhttpRequest({
method: "GET",
url: "http://www.example.net/",
headers: {
"User-Agent": "Mozilla/5.0", // If not specified, navigator.userAgent will be used.
"Accept": "text/xml" // If not specified, browser defaults will be used.
},
onload: function(response) {
var responseXML = null;
// Inject responseXML into existing Object (only appropriate for XML content).
if (!response.responseXML) {
responseXML = new DOMParser()
.parseFromString(response.responseText, "text/xml");
}

GM_log([
response.status,
response.statusText,
response.readyState,
response.responseHeaders,
response.responseText,
response.finalUrl,
responseXML
].join("\n"));
}
});

Публикувайте отговор

Влезте, за да публикувате отговор.