Erehk
said
:
Indecent Act
said
:
A simple example would be restore last post option, it's something that's not needed often but when needed feels like a life saver.
I've fortunately yet to need this one, but it's such a cool feature.
Will definitely be glad to have it at some point, I'm sure.
I only said this 2 days ago, but I spoke too soon!
I clicked preview on a post and my log-in session ended, so the 'restore last post' saved me from a lot of re-writing!
AoDude
said
:
Well, still wrapping my head around this jsonp thing... I am writing a function over node.js to handle a command using the 'request' repository to get that return. I still don't quite have it correctly coded yet...
Hey there
This code should do it:
// === server.js
var http = require('http');
var request = require('request');
var list = JSON.stringify(["le me","Scuzzy","Los","Omid","iTrolledU","Lib Tech","Jessie","Wisely Done","My Kingz","Mr Blob"]);
var url = `http://services.runescape.com/m=website-data/playerDetails.ws?names=${list}&callback=jQuery000000000000000_0000000000&_=0`;
The tricky part is that the API only accepts a specific callback pattern. It also has a strict rate limit and gives 404's without a useful error message.
This page helped me out a bit:
http://runescape.wikia.com/wiki/Application_programming_interface
Let me know if you need more help
*passes a nice coffee to Indy*
https://selectivelyattentive.files.wordpress.com/2015/12/cafe-mono-latte-art-san-diego_eatsd-620x350.jpg?w=640
AoDude
said
:
Indecent Act
said
:
AoDude
said
:
rip, nope
I have a feeling I know what you were trying to do. Assuming you were trying to do something.
If I'm right, I'll make it so you can do it
You know me well..
If you wish you can give it another try and see how you go
Version: 3.1.9.50 needed. Will only work on this thread btw.
27-Apr-2016 16:47:49
- Last edited on
27-Apr-2016 17:05:38
by
Indecent Act
That previous post didn't work. Looked into it, canonical should === "261,262,33,65181208" instead of "261-262-33-65181208" unless I am missing something...
Edit: Editing my local version of threadview.js to use commas instead of dashes confirmed fixed it.
AO
Deputy-Owner
:
The Nexus CC
27-Apr-2016 20:12:54
- Last edited on
27-Apr-2016 22:01:24
by
AoDude
The tricky part is that the API only accepts a specific callback pattern. It also has a strict rate limit and gives 404's without a useful error message.
This page helped me out a bit:
http://runescape.wikia.com/wiki/Application_programming_interface
Let me know if you need more help
I have had some success with a different method, which gives me everything I need for clans. However, I continued to try other things, including your code, to try to get an unabridged version of the api in an attempt to be able to check online status.
For instance, see the difference between clicking this link, and copy pasting it in your address bar: http://services.runescape.com/m=website-data/playerDetails.ws?names=%5B%22aodude%22%5D&callback=jQuery000000000000000_0000000000&_=0
Clicking the link gives you 2 more variables than if you copy/paste, "Online" & "World".
Now after trying your code, tbh the command structure I am used to didn't work. For instance nesting a console.log(body); inside the request didn't do anything when I ran the code. I am probably missing something, because I haven't used http.createserver for anything before.
So, A: I am not sure what I am doing wrong with your code, and B: I am not sure if those 2 additional variables are even obtainable since the request is outside of runescape.com..
AO
Deputy-Owner
:
The Nexus CC
27-Apr-2016 21:48:24
- Last edited on
10-May-2016 02:24:52
by
AoDude
AoDude
said
:
Now after trying your code, tbh the command structure I am used to didn't work. For instance nesting a console.log(body); inside the request didn't do anything when I ran the code. I am probably missing something, because I haven't used http.createserver for anything before.
So, A: I am not sure what I am doing wrong with your code, and B: I am not sure if those 2 additional variables are even obtainable since the request is outside of runescape.com..
Aww, not sure what's wrong exactly in the first case but I would check a couple of things including what happens when you do console.log(error). http.createServer() is just a different way to handle server requests. It doesn't have the advanced routing features of something like express or koa, but it's alright for giving a code snippet.
The documentation for http.createServer():
https://nodejs.org/api/http.html#http_http_createserver_requestlistener
About accessing those variables from another domain, after spending some time trying to work it out, I managed to find a way to get online status from the website-data api.
It turns out that it requires an authenticated request with a runescape referer in the header:
// === server.js
var http = require('http');
var request = require('request');
var list = JSON.stringify(["le me","Scuzzy","Los","Omid","iTrolledU","Lib Tech","Jessie","Wisely Done","My Kingz","Mr Blob"]);
var url = `http://services.runescape.com/m=website-data/playerDetails.ws?names=${list}&callback=jQuery000000000000000_0000000000&_=0`;
The session cookie can be found in the resources tab of the developer's console (Dev console -> Resources -> Cookies -> services.runescape.com -> session). If someone has access to the cookie I think it means they can log in as you, so it's best to keep it safe.
Getting a session id seems to require logging in to the RS website, so I don't think there's an easy way to obtain it programatically.
Let me know if I can help with getting any of it working.