Git Product home page Git Product logo

cloud189checkin's Introduction

Cloud189Checkin

天翼网盘自动签到(随机容量) 和抽奖(三次,每次 50M,共 150M)获取空间,家庭空间签到(随机容量)。

重要说明!!!

请勿直接修改 .env,然后提交到 github,源码仓库是公开的,别人可以直接看到你的账号密码。因为错误使用本仓库导致账号密码泄漏,本人概不负责!!!

目录

GitHub Action 运行

Fork 此仓库

设置账号密码

新版本的 git Action 需要创建 environment 来配合使用,创建一个名为 user 的环境。 创建好后编辑 user 环境,添加变量 TY_ACCOUNTS, userName 和 password 为你的天翼账号和密码,可以添加多个账号如[{"userName":"账号 1","password":"账号 1 的密码"},{"userName":"账号 2","password":"账号 2 的密码"}]

设置推送

Server 酱

为了考虑到不同客户端兼容性,采用了 Server 酱,只需多配置下 SENDKEY 就行,Server 酱的配置和 sendkey 的获取可参看Server 酱官网

TelegramBot 推送

  • TELEGRAM_BOT_TOKEN Telegram Bot Token
  • TELEGRAM_CHAT_ID Telegram 接收推送消息的会话 ID

微信群机器人推送

WxPusher 推送

执行任务

  1. 点击Action,再点击I understand my workflows, go ahead and enable them
  2. 给自己仓库点个 start 或者修改任意文件后提交一次或者手动点击运行
  3. 每天早上 10 点执行任务

查看运行结果

Actions > Cloud check in action > build

本地运行

环境配置

Node.js 18+

克隆项目

git clone https://github.com/wes-lin/Cloud189Checkin.git
cd Cloud189Checkin

安装依赖

npm install

运行

​ 修改源码中.env 中 userName 和 password 为你的天翼账号和密码,可以添加多个账号如[{"userName":"账号 1","password":"账号 1 的密码"},{"userName":"账号 2","password":"账号 2 的密码"}]

TY_ACCOUNTS=[{"userName":"userName","password":"password"}]

推送

修改 serverChan.js 或者添加环境变量 SENDKEY

执行命令

npm start

其他环境集成

我已经天翼网盘的相关 API 集成到SDK了,有编程能力的同学可以自行拓展,集成到自己的代码环境。

交流群

cloud189checkin's People

Contributors

hugcabbage avatar j2rong4cn avatar jqtmviyu avatar lanyundev avatar wes-lin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cloud189checkin's Issues

.

搞错了,是我变量名称复制了空格进去

多帐号签到错误

多帐号签到运行错误

image

SyntaxError: Unterminated string in JSON at position 94
at JSON.parse ()
at Object. (/home/runner/work/Cloud189Checkin/Cloud189Checkin/accounts.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object. (/home/runner/work/Cloud189Checkin/Cloud189Checkin/src/app.js:24:18)
at Module._compile (node:internal/modules/cjs/loader:1358:14)

疑似密码里有#号,更改密码后,还是出错,代码为:

SyntaxError: Expected ',' or ']' after array element in JSON at position 51
at JSON.parse ()
at Object. (/home/runner/work/Cloud189Checkin/Cloud189Checkin/accounts.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object. (/home/runner/work/Cloud189Checkin/Cloud189Checkin/src/app.js:24:18)
at Module._compile (node:internal/modules/cjs/loader:1358:14)

登录被验证码拦截

[build-and-deploy]里出现
Error: 024-08-02T16] [ERROR] default - 图形验证码错误,请重新输入

感谢作者无私分享,请教一个问题:脚本每天执行的时候,会出现time out

`> [email protected] start

node --unhandled-rejections=strict ./src/app.js

[2024-05-30T12:25:13.904] [INFO] default - 账户 1773846开始执行
Error: 024-05-30T12:25:21.394] [ERROR] default - 登录失败:{"code":"ETIMEDOUT"}
[2024-05-30T12:25:21.394] [INFO] default - 账户 177
3846执行完毕
[2024-05-30T12:25:21.395] [INFO] default - 账户 1536808开始执行
Error: 024-05-30T12:25:22.858] [ERROR] default - 登录失败:{"code":"ETIMEDOUT"}
[2024-05-30T12:25:22.858] [INFO] default - 账户 153
6808执行完毕
[2024-05-30T12:25:24.555] [INFO] default - ServerChan推送成功
Command completed after 1 attempt(s).`

要解决它,需要事先登录一下网页版网盘,然后reaction就能通过,请教如何破

SyntaxError: Unexpected end of JSON input

求助

JSON校验过了,没问题,不知道为什么一直报这个错误。
密码在Re6后面还有的,这是识别不全吗?是不是因为密码里有字符吗?比如密码里含有#%&@之类的。

> [email protected] start
> node --unhandled-rejections=strict ./src/app.js

undefined:1
[{"userName":"xxxxx","password":"Re6

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/home/runner/work/Cloud189Checkin/Cloud189Checkin/accounts.js:1:23)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:[12](https://github.com/lywly/Cloud189Checkin/actions/runs/10389498844/job/28767643955#step:6:13)03:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/home/runner/work/Cloud189Checkin/Cloud189Checkin/src/app.js:25:18)
    at Module._compile (node:internal/modules/cjs/loader:[13](https://github.com/lywly/Cloud189Checkin/actions/runs/10389498844/job/28767643955#step:6:14)64:[14](https://github.com/lywly/Cloud189Checkin/actions/runs/10389498844/job/28767643955#step:6:15))

Node.js v18.20.4
Warning: Attempt 1 failed. Reason: Child_process exited with error code 1

每日抽奖第2次、第3次抽奖失败

[2024-04-21T03:42:26.675] [INFO] default - 第2次抽奖成功,抽奖获得undefined
[2024-04-21T03:42:26.675] [INFO] default - 第3次抽奖成功,抽奖获得undefined

参考大佬的写了一个适用青龙的

/*
cron: 50 8 * * *
const $ = new Env("天冀云盘签到");
*/
//https://github.com/wes-lin/Cloud189Checkin/blob/main/src/app.js#L162
const axios = require('axios');
const qs = require('qs');
const crypto = require("crypto");
const JSEncrypt = require('node-jsencrypt');
const notify = require('./sendNotify');
const qlapi = require('./tol_qlapi');
const config = {
  clientId: '538135150693412',
  model: 'KB2000',
  version: '9.0.6',
  pubKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCZLyV4gHNDUGJMZoOcYauxmNEsKrc0TlLeBEVVIIQNzG4WqjimceOj5R9ETwDeeSN3yejAKLGHgx83lyy2wBjvnbfm/nLObyWwQD/09CmpZdxoFYCH6rdDjRpwZOZ2nXSZpgkZXoOBkfNXNxnN74aXtho2dqBynTw3NFTWyQl8BQIDAQAB',
}
const headers = {
  'User-Agent': `Mozilla/5.0 (Linux; U; Android 11; ${config.model} Build/RP1A.201005.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/${config.version} Android/30 clientId/${config.clientId} clientModel/${config.model} clientChannelId/qq proVersion/1.0.6`,
  'Referer': 'https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1',
  'Accept-Encoding': 'gzip, deflate',
};

async function doLogin(uname, passwd) {
  try {
    let resp = await axios.post('https://open.e.189.cn/api/logbox/config/encryptConf.do?appId=cloud');
    let pubKey = resp.data.data.pubKey;
    resp = await axios.get('https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html?returnURL=/main.action');
    //获取最后请求url中的参数reqId和lt
    let Reqid = resp.request.path.match(/reqId=(\w+)/)[1];
    let Lt = resp.request.path.match(/lt=(\w+)/)[1];
    let tHeaders = {
      "Content-Type": "application/x-www-form-urlencoded",
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0',
      'Referer': 'https://open.e.189.cn/', Lt, Reqid,
    };
    let data = { version: '2.0', appKey: 'cloud' };
    resp = await axios.post('https://open.e.189.cn/api/logbox/oauth2/appConf.do', qs.stringify(data), { headers: tHeaders });
    let returnUrl = resp.data.data.returnUrl;
    let paramId = resp.data.data.paramId;
    const keyData = `-----BEGIN PUBLIC KEY-----\n${pubKey}\n-----END PUBLIC KEY-----`;
    const jsencrypt = new JSEncrypt();
    jsencrypt.setPublicKey(keyData);
    const enUname = Buffer.from(jsencrypt.encrypt(uname), 'base64').toString('hex');
    const enPasswd = Buffer.from(jsencrypt.encrypt(passwd), 'base64').toString('hex');
    data = {
      appKey: 'cloud',
      version: '2.0',
      accountType: '01',
      mailSuffix: '@189.cn',
      validateCode: '',
      returnUrl,
      paramId,
      captchaToken: '',
      dynamicCheck: 'FALSE',
      clientType: '1',
      cb_SaveName: '0',
      isOauth2: false,
      userName: `{NRP}${enUname}`,
      password: `{NRP}${enPasswd}`,
    };
    resp = await axios.post('https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do', qs.stringify(data), { headers: tHeaders, validateStatus: null });
    if (resp.data.toUrl) { 
      let cookies = resp.headers['set-cookie'].join(';');
      resp = await axios.get(resp.data.toUrl, { headers: { ...headers, Cookie: cookies }, maxRedirects: 0, validateStatus: null });
      cookies += '; ' + resp.headers['set-cookie'].join(';');
      return cookies;
    }
    console.log('doLogin: ', resp.data);
  } catch (error) {
  }
  return null;
}

function getSignature(data) { 
  const e = Object.entries(data).map((t) => t.join("="));
  e.sort((a, b) => (a > b ? 1 : a < b ? -1 : 0));
  return crypto.createHash("md5").update(e.join("&")).digest("hex");
}

async function familyCheckin(cookies) { 
  const ckRes = []
  try {
    let resp = await axios.get('https://cloud.189.cn/api/portal/v2/getUserBriefInfo.action', { headers: { ...headers, Cookie: cookies }, validateStatus: null });
    let { sessionKey } = resp.data;
    let time = String(Date.now());
    let signature = getSignature({ sessionKey, Timestamp: time, AppKey: '600100422' });
    let sHeader = { "Sign-Type": "1", Signature: signature, Timestamp: time, Appkey: '600100422' };
    resp = await axios.get(`https://cloud.189.cn/api/open/oauth2/getAccessTokenBySsKey.action?sessionKey=${sessionKey}`, { headers: { ...sHeader, Cookie: cookies }, validateStatus: null });
    let { accessToken } = resp.data;
    //getFamilyList
    time = String(Date.now());
    signature = getSignature({ AccessToken: accessToken, Timestamp: time });
    sHeader = { "Sign-Type": "1", Signature: signature, Timestamp: time, Accesstoken: accessToken, Accept: "application/json;charset=UTF-8" };
    resp = await axios.get('https://api.cloud.189.cn/open/family/manage/getFamilyList.action', { headers: { ...sHeader, Cookie: cookies }, validateStatus: null });
    let familyIds = resp.data.familyInfoResp.map(item => item.familyId);
    for await (const familyId of familyIds) {
      time = String(Date.now());
      signature = getSignature({ familyId, AccessToken: accessToken, Timestamp: time });
      sHeader = { "Sign-Type": "1", Signature: signature, Timestamp: time, Accesstoken: accessToken, Accept: "application/json;charset=UTF-8" };
      resp = await axios.get(`https://api.cloud.189.cn/open/family/manage/exeFamilyUserSign.action?familyId=${familyId}`, { headers: { ...sHeader, Cookie: cookies }, validateStatus: null });
      // console.log('familyCheckin: ', resp.data);
      ckRes.push('家庭任务' + `${resp.data.signStatus ? "已经签到过了," : ""}签到获得${ resp.data.bonusSpace }M空间`);
    }
  } catch (error) {
    console.log('familyCheckin: ', error);
    ckRes.push('家庭任务异常');
  }
  return ckRes;
}

async function doCheckin(cookies) { 
  let tasks = [
    `https://cloud.189.cn/mkt/userSign.action?rand=${new Date().getTime()}&clientType=TELEANDROID&version=${config.version}&model=${config.model}`,
    'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN',
    'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN',
    'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN',
  ];
  const ckRes = []
  let index = 0;
  for (const task of tasks) {
    try {
      let resp = await axios.get(task, { headers: { ...headers, Cookie: cookies }, validateStatus: null });
      console.log(task, resp.data);
      if (index === 0) { 
        ckRes.push(`${resp.data.isSign ? '已经签到过了,' : ''}签到获得${resp.data.netdiskBonus}M空间`);
      }else if (resp.data.errorCode === 'User_Not_Chance') {
        ckRes.push(`第${index}次抽奖失败,次数不足`);
      } else {
        ckRes.push(`第${index}次抽奖成功,抽奖获得${resp.data.prizeName}`);
      }
    } catch (error) {
      ckRes.push(`第${index}签到失败`);
    }
    index++;
    await new Promise((resolve) => setTimeout(resolve, 5000));
  }
  return ckRes;
}

async function getSizeInfo(cookies) { 
  let message = [];
  try {
    let resp = await axios.get('https://cloud.189.cn/api/portal/getUserSizeInfo.action', { headers: { ...headers, Cookie: cookies, Accept: "application/json;charset=UTF-8" }, validateStatus: null });
    let { cloudCapacityInfo, familyCapacityInfo } = resp.data;
    let totalSize = (cloudCapacityInfo.totalSize / 1024 / 1024 / 1024).toFixed(2);
    let usedSize = (cloudCapacityInfo.usedSize / 1024 / 1024 / 1024).toFixed(2);
    let freeSize = (cloudCapacityInfo.freeSize / 1024 / 1024 / 1024).toFixed(2);
    message.push(`个人总容量${totalSize}G, 已使用${usedSize}G, 可用${freeSize}G`);
    totalSize = (familyCapacityInfo.totalSize / 1024 / 1024 / 1024).toFixed(2);
    usedSize = (familyCapacityInfo.usedSize / 1024 / 1024 / 1024).toFixed(2);
    freeSize = (familyCapacityInfo.freeSize / 1024 / 1024 / 1024).toFixed(2);
    message.push(`家庭总容量${totalSize}G, 已使用${usedSize}G, 可用${freeSize}G`);
  } catch (error) {
    console.log('getSizeInfo error: ', error);
    message.push('获取用户容量异常');
  }
  return message;
}

!(async () => { 
  const c189s = await qlapi.getQLEnvs('CLOUD_189');
  // const c189s = { data: [{ value: '123456&123@112' }] };
  if (!c189s || !c189s.data || !c189s.data.length) {
    console.log('未获取到天冀云盘 CLOUD_189');
    return;
  }
  const message = []
  let index = 1;
  for (const c189 of c189s.data) {
    //uname passwd从c189中获取
    let uname = c189.value.split('&')[0];
    let passwd = c189.value.split('&')[1];
    console.log(`开始签到第${index}个账号,${uname}`);
    let cookies = await doLogin(uname, passwd);
    if (cookies) {
      message.push(`账号${index}-${uname}`);
      let ckMsgs = await doCheckin(cookies);
      message.push(...ckMsgs);
      let fmlyMsgs = await familyCheckin(cookies);
      message.push(...fmlyMsgs);
      let sizeMsgs = await getSizeInfo(cookies);
      message.push(...sizeMsgs);
    }else{
      message.push(`账号${index}-${uname}登录失败`);
    }
    index++;
    message.push('------------------------\n');
  };
  console.log(message.join('\n'));
  await notify.sendNotify(`天冀云盘签到`, message.join('\n'))
})();

登录不了,是因为账号原因么?

[2023-08-10T02:38:53.896] [INFO] default - 账户 usee开始执行
Error: 023-08-10T02:39:00.976] [ERROR] default - 登录失败:"图形验证码错误,请重新输入"
[2023-08-10T02:39:00.976] [INFO] default - 账户 use
e执行完毕

这是哪里有问题

Run nick-fields/retry@v3

cloud@1.0.0 start
node --env-file=.env --unhandled-rejections=strict ./src/app.js

Command completed after 1 attempt(s).
微信截图_20240811001310

请问server酱怎么不推送呢

rt 我已经配置好了server酱 服务器测试也能发送接受成功 但是这个项目填写之后还是收不到。
要开启什么吗

建议将项目中的 Server酱 链接换成推荐链接

您好,我是 Server酱的作者 Easy 。注意到您的项目中对接或提及了 Server酱,非常感谢对我们的支持。

这里有一个小建议。Server酱最近推出了「推荐返现计划」,您可以在项目中Server酱的官网链接后边加上推荐参数,这样在用户从这里进入Server酱并订阅会员后,您的项目将获得2元/单的佣金。

只需要用微信登录fx.ftqq.com ,然后开通计划就可以获得您的推荐链接,佣金会实时地转入开通账号的微信零钱中。

希望这个计划能让您的开源项目更好。


Hello, I am Easy, the author of ServerChan. I noticed that your project has integrated or mentioned ServerChan, and I am very grateful for that.

I have a small suggestion. ServerChan has recently launched a "Referral Cashback Program". You can add a referral parameter to the link to ServerChan's official website in your project. This way, when users enter ServerChan through your link and subscribe to a membership, your project will earn a commission of 2 RMB per subscription.

You just need to log in to fx.ftqq.com with WeChat, activate the program, and you will get your referral link. The commission will be instantly transferred to the WeChat Wallet of the account that activated the program.

Even though the earnings might not be substantial, I hope this program can provide some additional support for your open-source project.

是否有计划添加自定义端口?

Servers酱低频使用一下还行,但量多一点就要付费了。不过他有个开源计划能通过云函数搭建。但网址会发生变化,因此能不能把发送过程独立出来以支持修改呢?

定时启动,如何操作?

我看脚本里已经有计划表示3.35会自动运行。可是在3.35未按计划自动运行,请问是什么原因?

改进:账号密码读取方式

目前通过指定多个变量填写用户信息,扩展性和易用性上都不是很好

改进:通过两个变量,一个放用户名一个放密码,通过空格隔开多个用户信息,代码里只需要通过空格切割循环处理即可

限制:用户名和密码需要按位置对应输入

username: user1 user2 user3
password: password1 password2 password3

分享: 在自己的服务器定时运行

  1. npm 安装 pm2
  2. 创建 cron.json
{
  "apps": [
    {
      "name": "189checkin",
      "script": "src/app.js",
      "cron_restart": "22 0 * * *",
      "autorestart": true,
      "max_restarts": 1
    }
  ]
}
  1. pm2 start cron.json
  2. 查看记录 pm2 logs 189checkin

不会自动运行

配置好了,不会每天自动运行需要自己去运行,怎么回事

提示图像验证码

手机浏览器,电脑浏览器,电脑脚本 都是直接密码登录的,怎么github一直提示验证码呢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.