Initial commit.

This commit is contained in:
larruda 2014-09-07 22:06:54 -03:00
parent 939ae7762e
commit c878f90290

11
craw.js
View file

@ -24,6 +24,12 @@ LOGIN_URL = 'https://auth.api.sonyentertainmentnetwork.com/login.jsp';
FREE_GAMES_URL = 'https://store.sonyentertainmentnetwork.com/#!/en-us/free-games/cid=STORE-MSF77008-PSPLUSFREEGAMES';
FREE_TO_PLAY_URL = 'https://store.sonyentertainmentnetwork.com/#!/en-us/free-to-play/cid=STORE-MSF77008-PS3F2PPS3';
var urls = [];
urls.push(FREE_TO_PLAY_URL);
if (casper.cli.has('psn-plus-member')) {
urls.push(FREE_GAMES_URL);
}
casper.start(LOGIN_URL, function() {
'use strict';
this.echo('Logging in...');
@ -41,8 +47,8 @@ casper.waitForUrl(/loginSuccess\.jsp$/, function() {
this.echo('Failed to login.', 'ERROR').exit(-1);
});
//casper.thenOpen(FREE_GAMES_URL, function() {
casper.thenOpen(FREE_TO_PLAY_URL, function() {
casper.eachThen(urls, function(response) {
this.thenOpen(response.data, function(response) {
'use strict';
this.echo(this.getTitle());
@ -80,6 +86,7 @@ casper.thenOpen(FREE_TO_PLAY_URL, function() {
}, function() {
this.echo("Houston, we have a problem!", 'ERROR');
}, 15000);
});
});
casper.then(function() {