-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmint.js
43 lines (31 loc) · 1016 Bytes
/
mint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* To use, run phantomjs mint.js <mint_email_address> <mint_password> <start_date format:MM/DD/YYYY> <end_date format:MM/DD/YYYY>
* @author Chris Alvares <[email protected]>
* @license MIT
*/
phantom.injectJs('lib/jquery.js');
phantom.injectJs('src/login.js');
phantom.injectJs('src/datagrabber.js');
if(phantom.args.length < 4)
{
console.log('{"error":"not correct amount of args"}');
phantom.exit();
}
var username = jQuery.trim(phantom.args[0]);
var password = jQuery.trim(phantom.args[1]);
var startdate = jQuery.trim(phantom.args[2]);
var enddate = jQuery.trim(phantom.args[3]);
window.setTimeout(function(){
phantom.exit();
}, 120000);
var page = require('webpage').create(),
system = require('system');
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) {
// console.log(msg);
};
var login = new window.Login(page);
login.login(username, password, function() {
var data = new DataGrabber(page);
data.getNetIncome(startdate, enddate);
});