mirror of
https://github.com/larruda/ps-store-crawler.git
synced 2025-07-05 20:51:21 -07:00
Initial commit.
This commit is contained in:
parent
939ae7762e
commit
c878f90290
1 changed files with 38 additions and 31 deletions
11
craw.js
11
craw.js
|
@ -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());
|
||||
|
||||
|
@ -81,6 +87,7 @@ casper.thenOpen(FREE_TO_PLAY_URL, function() {
|
|||
this.echo("Houston, we have a problem!", 'ERROR');
|
||||
}, 15000);
|
||||
});
|
||||
});
|
||||
|
||||
casper.then(function() {
|
||||
if (!games.length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue