Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
AoDude said :
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.
Oh damn I'll make the change and update later. Thanks for trying it and figuring that out :)

AoDude said :
Clicking the link gives you 2 more variables than if you copy/paste, "Online" & "World".
You need a valid session. Think of it as trying to retrieve your friends list without being logged in.

Blasty said :
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.

I don't know about node.js, but with php curl it should be very easy. Php is made for this, it can log you in securely pull what ever data you want, then log you out again when done. With use of the cookie jar you maintain you session across pages and can traverse pages without an issue.

I haven't tried it (I don't want to use my account for such things) but this is simple stuff for curl. Works over https and honours valid (or not) certs too.

28-Apr-2016 03:57:54 - Last edited on 28-Apr-2016 03:58:37 by Indecent Act

Blasty
Feb Member 2017

Blasty

Posts: 9,319 Rune Posts by user Forum Profile RuneMetrics Profile
Indecent Act said :
I don't know about node.js, but with php curl it should be very easy. Php is made for this, it can log you in securely pull what ever data you want, then log you out again when done. With use of the cookie jar you maintain you session across pages and can traverse pages without an issue.


Ooh, I hadn't tried it in node since I was so used to it not working in apps script.

After some fiddling, I got it working in node :D . The following code gets an authenticated session and uses it to get login status:

// === 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`;

http.createServer(function(req, res) {
request({
url:"https://secure.runescape.com/m=weblogin/login.ws",
method:"POST",
form: {
username: "
<username>
",
password: "
<password>
",
mod:"www",
ssl: "1",
dest: "community"
}
}, function(error, response, body) {
var sessioncookie = response.headers["set-cookie"].filter(cookie=>/^session=/.test(cookie));

if (sessioncookie.length == 0) {
res.end("Couldn't get session" );
return;
}

var sessionMatch = sessioncookie[0].match(/^session =( [a-zA-Z0-9\-\*]*)/);

if (sessionMatch == null) {
res.end("Couldn't get session" );
return;
}

var headers = {
Referer: "http://services.runescape.com",
Cookie: `session=${sessionMatch[1]}`
}

request({url: url, headers: headers}, function(error, response, body) {
res.end(body)
});
})

}).listen(8080);

// ===
Blasty
// @BlastytheBlue // Blasty#5167
| Co-owner of Mine Nation

28-Apr-2016 05:34:46

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
https://i.imgur.com/wyr60sf.png

That screenshot explains everything I didn't understand about http.createServer! Ok, your code was working, I just didn't know how to use it. (still not sure I can get the data to pass on to the following functions though... You were just creating an endpoint for that data. May have to exclude http.createServer completely, and just use request...)

Do you have any idea how long they issue session id's for? Maybe something I can use fs to write a text file, and only request if I need a new session id... And it really doesn't matter what account logs in, would it? If I made a throw away account, there should be no risk. Not that I would be giving anything out. It is still all solely hosted on my personal server.
AO
Deputy-Owner :
The Nexus CC

28-Apr-2016 06:08:10

Body btw

Body btw

Posts: 19,488 Opal Posts by user Forum Profile RuneMetrics Profile
Indecent Act said :
Klyntar said :
Just stopping by

Hiya Accuser, hope all is well :)
Lust said :
*waves*
'ello :)

I hope it's ok I used this Original message details are unavailable.
http://indecentcode.com/hs/hall_of_fame.php?id=
on a thread, and I noticed we haven't updated Le me on the overall XP achievement yet (not that this is a big deal, but a good excuse to pop in and say hi :) )
"Why are you posting threads, asking questions and making discussion???"


All I do anymore is fish - 2017

28-Apr-2016 06:10:04 - Last edited on 28-Apr-2016 06:10:21 by Body btw

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Very nice work Blasty and AoDude :)

I just got home and I was thinking of making a php version. Not going to bother now, looks like node handles it really nicely :)

I really should learn node, just I have too much to do as it is.

Lust said :
*waves*

Hiya Lust :)

Body btw said :
I noticed we haven't updated Le me on the overall XP achievement

Yeah I really need to get around to doing that, thanks for the reminder. I need that sometimes :)

28-Apr-2016 09:46:35

Quick find code: 261-262-33-65181208 Back to Top