精易论坛

标题: Node js 奇瑞俱乐部签到 源码 [打印本页]

作者: wadclife    时间: 2020-9-12 19:37
标题: Node js 奇瑞俱乐部签到 源码
  1. const axios = require("axios")
  2. const schedule = require("node-schedule")

  3. const config = {
  4.         headers: {}
  5. }

  6. const user = "" //账号
  7. const pass = ""        //密码


  8. async function sign() {
  9.         let re = ""

  10.         re = await axios.get("https://cheryclub.mychery.com/ump/cherypc/indexPC/index", )

  11.         let formToken = re.data.match(/name="formToken" value="(.*?)" \/>/)[1];
  12.         console.log(formToken);

  13.         config.headers.Cookie = re.headers['set-cookie'][0]

  14.         re = await axios.post("https://cheryclub.mychery.com/ump/cherypc/pcLogin/checkLogin",
  15.                 `user=${user}&password=${pass}`, config)
  16.         console.log(re.data);

  17.         re = await axios.post("https://cheryclub.mychery.com/ump/cherypc/indexPC/addSign",
  18.                 "formToken=" + formToken, config)
  19.         console.log(re.data);

  20.         return re.data.msg == "succ" ? true : false
  21. }

  22. async function start() {
  23.         for (let i = 0; i < 3; i++) {
  24.                 if (await sign()) break
  25.         }
  26. }

  27. schedule.scheduleJob('0 0 8 * * *', () => {
  28.         start()
  29. })

  30. console.log(new Date + "脚本启动成功,每天8点定时签到!")
复制代码



作者: 被封禁言    时间: 2020-9-12 21:38
这个不会跨域么
作者: Killing    时间: 2020-9-12 23:05

作者: wadclife    时间: 2020-9-13 00:36
被封禁言 发表于 2020-9-12 21:38
这个不会跨域么

node 环境运行.不是浏览器
作者: 小清晰2020    时间: 2020-9-14 09:24
看看11111




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4