SirMeltonJoin Date: 2013-06-05 Post Count: 551 |
I revised your page.js file.
pastebin/TAUBJqc8
You've probably already expanded upon it, though.
"Do not allow yourself to be blinded by fear or anger. Everything is only as it is." |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I took url out of the o array because ID and title is already there. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I left the idea of using a plugin and did it more efficiently without loading every page unnecessarily. Now I'm $.get()ting the source of every game page, parsing it and sorting it. It works very quickly (though maybe not as quickly as possible.)
var up=parseInt(code.replace(/,/g,'').match(/Thumbs up: [0-9]+/)[0].match(/[0-9]+/)[0]);
var down=parseInt(code.replace(/,/g,'').match(/Thumbs down: [0-9]+/)[0].match(/[0-9]+/)[0]);
var title=code.match(/item-header".\s*.h2 class="notranslate"..*.\/h2./)[0];
title=title.match(/notranslate"..*.\/h2./)[0].slice(13,-5);
var id=parseInt(code.match(/asset-id="[0-9]+/)[0].match(/[0-9]+/)[0]);
var creator=code.match(/"tooltip" original-title=".+"./)[0].match(/=".+"/)[0].slice(2,-1);
var visits=parseInt(code.replace(/,/g,'').match(/Visited: [\s\S]+.span class="stat".[0-9]+/)[0].match(/[0-9]+/)[0])
bracket matches replaced with .s |
|
|
That's good except that you can't then take advantage of pages that the user loads. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I wouldn't need to because it has probably already seen it. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I left it running for a few minutes and now I've checked 600 pages of games and sorted them all. If I could run it on a server or something then that would be great; I've never done anything like that before. I'm sure that after page 1000 everything is worthless so I'll make it recycle after that point (which could possibly take under half an hour to get to.) |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I'm having a hard time with the cross-domain policy. I'm able to do it in the chrome console so why is it a security issue from anywhere else? I tried using an iframe and it doesn't like that either. |
|
|
Apparently that's how it works.
You can set in the manifest what page to act like the extension is running from, but I'm pretty sure that kills the chrome.* api.
I really don't know.
XMLHttpRequests work fine for pages, but apparently the Games page doesn't give the list of games in source for pages > 1.. |
|
SirMeltonJoin Date: 2013-06-05 Post Count: 551 |
> 'I'm having a hard time with the cross-domain policy...'
Well, you shouldn't have a problem with the same-origin policy if you're using a Chrome extension, and have set the permissions allowing your extension to send these requests.
> 'You can set in the manifest what page to act like the extension is running from, but I'm pretty sure that kills the chrome.* api.'
I'm a little confused. Are you referring to content scripts? That shouldn't "kill" the Chrome.* API.
Can someone give me the latest version of the extension? |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I just said I want to run my code on a server. No I am not using a chrome extension and there is no manifest. |
|
|
You could eval() the code from a JSON/webrequest instead of using a tag to bypass the same-origin policy, but that's pretty bad practice since if your website is compromised, they can execute scripts on anyone with the extension... |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I need a way to parse the source of a page without being yelled at because the browser isn't doing it in the console on that domain. |
|
SirMeltonJoin Date: 2013-06-05 Post Count: 551 |
> 'I just said I want to run my code on a server. No I am not using a chrome extension and there is no manifest.'
I apologize for not reading all of your replies on this thread. |
|
|
Chrome extensions don't have permissions to use iframe's in background pages cross domain, I'm not sure why.
You won't be able to use JS to violate cross origin on a regular page. That's just not safe. |
|
|
'I need a way to parse the source of a page without being yelled at because the browser isn't doing it in the console on that domain.'
Welcome to Chrome. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
JS can be executed from the chrome console when it's on the same domain. It can't do anything if it's not on the same domain. It's very easy to GO to the domain and then run the code, so why bother restricting it? |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I want to do what the chrome console is able to do in the same domain, but not from the chrome console, and not from the same domain. |
|
|
It is not easy to go to the domain and execute it, when you're talking about the scripts on a page. That's impossible. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
It is easy to do it manually. Why can it only be done manually? |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
All I need to do is parse the source of a cross-domain page. Is this possible? |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
y u no answer |
|
TenulJoin Date: 2013-04-25 Post Count: 41 |
> 'All I need to do is parse the source of a cross-domain page. Is this possible?'
Yes, of course it is. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
what a helpful and constructive answer! |
|
|
No, it's not. The only cross domain requests that can be done are the loading of script files. Unless the site offers 1) generated, standalone scripts that you can steal data from or 2) JSONP or similar, you won't be able to (or at least, you're not supposed to be able to) using pure JS.. |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
I'm trying to parse the game pages. I don't really need the entire source because the same text is displayed plainly, but I don't know how to access it from another domain. What about Uuvinu and all of his bots? How could he be scanning the website from a different domain? |
|