Created
September 2, 2015 09:56
-
-
Save ETiV/ea058b9936a1bf7452e9 to your computer and use it in GitHub Desktop.
ZiMuZu.tv auto-dosign script in javascript. (NodeJS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First, setup username and password. | |
// Second, run command `npm link request` to install the depends | |
// Then, setup cronjob for auto checkin everyday. | |
var USERNAME = '_FILL_ME_'; | |
var PASSWORD = '_FILL_ME_'; | |
var request = require('request'); | |
request = request.defaults({ | |
jar: true | |
}); | |
var login = function (username, password, cb) { | |
// login API | |
var url = 'http://www.zimuzu.tv/User/Login/ajaxLogin'; | |
request.post(url, { | |
json: true, | |
form: { | |
account: username, | |
password: password, | |
remember: 1, | |
url_back: 'http://www.zimuzu.tv' | |
} | |
}, function (err, resp, data) { | |
if (data['status'] == 1) { | |
cb(null); | |
} else { | |
cb(data['info']); | |
} | |
}); | |
}; | |
var enter = function (cb) { | |
// enter the sign page | |
var url = 'http://www.zimuzu.tv/user/sign'; | |
request.get(url, function (err, resp, body) { | |
// console.log(body); | |
cb(); | |
}); | |
}; | |
var sign = function (cb) { | |
// call dosign API | |
var url = 'http://www.zimuzu.tv/user/sign/dosign'; | |
request.get(url, { | |
headers: { | |
'Referer': 'http://www.zimuzu.tv/user/sign' | |
}, json: true | |
}, function (err, resp, data) { | |
// console.log(err); | |
cb(data); | |
}); | |
}; | |
login(USERNAME, PASSWORD, function (err) { | |
if (err == null) { | |
enter(function () { | |
setTimeout(function () { | |
sign(function (data) { | |
process.exit(0); | |
}); | |
}, 15 * 1000); | |
}); | |
} else { | |
process.exit(1); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment