Son not fish, know the joy of fish? Son is not I, Ann know I do not know the joy of fish?

preface

I do not know whether I am challenging the bottom line of the official [nuggets official], I am to see digg friends have made this kind of article, the official should not be so stingy (😄 😄 😄). Think of yourself before also engaged in this aspect of the “clever”, so turn to think of technical articles, not be blocked! (in fact, I was terrified 😜 😜 😜). For you dig friends happy life, dig gold community multi-account automatic check-in and lucky draw today!!

Mail delivery

First come a “hang” after checking in to the email push message. The reason for the first email push is because the email push is free, people malicious words are not much, directly start.

// index.js

"use strict"

// Nodemailer is an easy-to-use Node.js mail component
const nodeMailer = require('nodemailer');
// Easy to use, concise, and efficient HTTP library
const axios = require('axios');

/** * information configuration * 1, request check-in, lottery interface configuration * 2, request interface cookie configuration * 3, send mail configuration ** / 
const config = {
    "baseUrl": "https://api.juejin.cn"."apiUrl": {
      "getTodayStatus": "/growth_api/v1/get_today_status"."checkIn": "/growth_api/v1/check_in"."getLotteryConfig": "/growth_api/v1/lottery_config/get"."drawLottery": "/growth_api/v1/lottery/draw"
    },
    // See the picture below to obtain the cookie
    "cookie": `xxx`."email": {
      // User, from, to fill in their own QQ mailbox
      "user": "[email protected]"."from": "[email protected]"."to": "[email protected]".// Get the pass
      "pass": "xxx"}}// Request check-in interface
const checkIn = async() = > {const {cookie, baseUrl, apiUrl} = config;
  let {data} = await axios({url: baseUrl + apiUrl.checkIn, method: 'post'.headers: {Cookie: cookie}});
  return data
}

// Request a raffle interface
const draw = async() = > {const {cookie, baseUrl, apiUrl} = config;
  let {data} = await axios({ url: baseUrl + apiUrl.drawLottery, method: 'post'.headers: { Cookie: cookie } });
  return data
}

// Sign in and send email
const sendQQEmail = async (subject, html) => {
    let {user, from, to, pass } = config.email;
    const transporter = nodeMailer.createTransport({ service: 'qq'.auth: { user, pass } });
    transporter.sendMail({ from, to, subject, html },  (err) = > {
      if (err) return console.log('Failed to send mail:${err}`);
      console.log('Email sent successfully')})}exports.signIn = async() = > {const checkInData = await checkIn();
  const drawData = await draw();
  if(checkInData.data) {
    console.log('Nuggets signed successfully! Today to get${checkInData.data.incr_point}Integral, current total:${checkInData.data.sum_point}`)
    sendQQEmail('Nuggets signed in'.'Nuggets signed successfully! Today to get${checkInData.data.incr_point}Integral, current total:${checkInData.data.sum_point}`);
  } else {
    console.log('Nuggets failed to sign in')
    sendQQEmail('Nuggets failed to sign in'.JSON.stringify(checkInData));
  }
  if(drawData.data) {
    console.log('Nuggets win free draw, win:${drawData.data.lottery_name}`)
    sendQQEmail('Nuggets win free draw'.'Nuggets win free draw, win:${drawData.data.lottery_name}`);
  } else {
    console.log('Nuggets free draw fails')
    sendQQEmail('Nuggets free draw fails'.JSON.stringify(drawData)); }};Copy the code

Cookie obtaining instructions

  • First, log on to the Nuggets account
  • Second, F12 -> Network -> Fetch/XHR -> randomly select an interface -> find Cookie -> right-click Cookie value -> Copy Value. Then you can get the Cookie value, as shown below ↓

Obtain the PASS of qq mailbox

  • First, log in the web version of QQ mailbox
  • Second, the Settings – > account – > POP3 / IMAP/SMTP/Exchange/CardDAV/CalDAV service – > open – > generate the authorization code – > copy the authorization code. Then you can get the pass value, as shown in the figure ↓

Configure cloud function services

The cloud service is configured to automatically check you in and draw prizes every day.

Registered account

Start by openingCloud function serviceNext is a meal of wechat scan code and thenPersonal authentication

Click the “New” button to create cloud service ↓The next step is to put the above code into your new cloud service

As shown below, customize the function service ↓ firstNext, edit the function code

SignIn refers to the signIn method in the index.js file.

The index.js file is the code we wrote above

The package.json file is the package file referenced by the index.js file

{
  "name": "juejin"."version": "1.0.0"."description": ""."main": "index.js"."dependencies": {
    "axios": "^ 0.21.4"."nodemailer": "^ 6.7.2." "
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": ""."license": "ISC"
}

Copy the code

Note 0 0 8 * * * * is triggered at 8:00 every day

After clicking Finish, return to function service

Click the function name juejin again, ↓ as shown below

Start installing the “NodeMailer”, “Axios” packages

Click Terminal => New Terminal

Enter:

  cd ./src  // You need to CD it first because it is in SRC folder
  npm install // Install dependencies
Copy the code

Get all the files we need after the installationAfter everything is readyThe deployment ofService againtestthe

We’ll get what we want in the end

Check again to see if the email has received any information about the sign-in and the raffle

The results must be fineGo to the nuggets automatic check-in and free lottery email push OK.

SMS push

Secondly, there will be a “hang” of SMS push message after check-in. In fact, SMS push and email push are only the difference between the message push after check-in and lottery. Compared with email push, it is still paid, but SMS push is simple and easy to view. Don’t talk too much!

Mutual million wireless

The SMS sending platform used here is mutual translation infinite, no advertising meaning ah, is casually looking for one, found this is relatively simple, the document is more clear to use him.

Create account

  • The first is to register an account mutual billion wireless
  • After registration, choose to learn to use
  • Then I splashed out on a $10 package of 166 messages (I also paid a fortune for the article). Hard-earned money 💰 Ah brothers)
  • Once you’ve bought it, go to the main page,

People don’t talk much, go straight to the code

"use strict"

// Easy to use, concise, and efficient HTTP library
const axios = require('axios');

/** * information configuration * 1, request check-in, lottery interface configuration * 2, request interface cookie configuration * 3, send mail configuration ** / 
const config = {
    "baseUrl": "https://api.juejin.cn"."apiUrl": {
      "getTodayStatus": "/growth_api/v1/get_today_status"."checkIn": "/growth_api/v1/check_in"."getLotteryConfig": "/growth_api/v1/lottery_config/get"."drawLottery": "/growth_api/v1/lottery/draw"
    },
    // See the picture below to obtain the cookie
    "cookie": `xxx`."mobile": {
      APIID is the APIID in the green box above
      "account": "xxx".// The APIKEY in the green box above
      "password": "xxx".// The phone number to receive the message
      "mobile": "xxx".// Use the default text message template
      "content": "Your verification code is 1234. Please do not disclose the captcha code to others."}}// Request check-in interface
const checkIn = async() = > {const {cookie, baseUrl, apiUrl} = config;
  let {data} = await axios({url: baseUrl + apiUrl.checkIn, method: 'post'.headers: {Cookie: cookie}});
  return data
}

// Request a raffle interface
const draw = async() = > {const {cookie, baseUrl, apiUrl} = config;
  let {data} = await axios({ url: baseUrl + apiUrl.drawLottery, method: 'post'.headers: { Cookie: cookie } });
  return data
}

// Sign in and send the message
const sendMessage = (checkInData, drawData) = > {
  let {account, password, mobile, content} = config.mobile;
  axios.get(`https://106.ihuyi.com/webservice/sms.php?method=Submit&account=${account}&password=${password}&mobile=${mobile}$content=${content}`)
  .then((res) = > {
    console.log('SMS sent successfully'); })}exports.signIn = async() = > {const checkInData = await checkIn();
  const drawData = await draw();
  sendMessage(checkInData, drawData)
};


Copy the code

To this nuggets automatic check-in and free lottery SMS push OK. For personal advice, it is not better to use email to push information. After all, it is free and more convenient to be self-sufficient. SMS push not only need to spend money, but also all kinds of configuration, relatively or a little laborious.

Finally, tell XDM that you can configure multiple accounts 😎 😎 😎 😎 😎

XDM say nothing and give it a thumbs up!!