Too old to remember?

Then you might need an automatic check-in script

Here comes the tutorial… But I had nothing to do with it

1. Initialize a Node project, NPM init

2, press Enter, the default entry file is index.js, so we will create a new index.js file in the root directory.

3. Copy the following code

Const request = require('request') const schedule = require('node-schedule') const schedule = require('node-schedule') I found the cookie in Request Headers, Const cookies = 'XXXXXX 'const hacpaiSignRequest = (signUrl,method) => let options = { url: signUrl, method, headers: { 'Referer': 'https://juejin.cn/', 'Upgrade-Insecure-Requests': 1, 'user-agent ': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', 'cookie': hacCookie } } let nowTime = new Date(); The console. The log (" time: "+ nowTime. ToLocaleTimeString ()); Request (options, (err, res, body) => {nowTime = new Date(); If (err) {the console. The log (nowTime. ToLocaleTimeString () + "-- -- -- -- > sign in attempt failed -- -- -- -- > \ n" + err); } else {the console. The log (nowTime toLocaleTimeString () + "-- -- -- -- > sign in request success -- -- -- -- > \ n"); Console. log(body)}})}const signTask = () => {schedule.scheduleJob('2 00 * * *', () => { let nowTime = new Date(); The console. The log (" \ n \ n \ n ") the console. The log (" -- -- -- -- - > "+ nowTime. ToLocaleDateString () +" - start check-in < -- -- -- -- -- "); / / url replace sign in the url, here I am the only example hacpaiSignRequest (' https://api.juejin.cn/interact_api/v1/message/count 'and' POST ')})} signTask ()Copy the code

4. Change the cookie in the code to your own, and change the request URL to the check-in URL to save

If you don’t have a cloud server, you’ll have to leave your computer on. Then it will automatically check in at 12am every day.