我们不生产代码,我们只是论坛的搬运工,把最近论坛上发烂了的夸克网盘的签到脚本改成了 wps 版(不要在我这评论夸克怎么样啊,我又不是阿里 CEO)
推送参考(以及不知道怎么用wps在线文档的也可以看):https://as.js.cool/demo/wps/
如果你需要复用之前阿里云盘签到配置的推送,可以直接在之前创建的表格中新建一个名为 夸克网盘
的工作表。
就像图里一样。
路过图床挂了,就不补了,一来没人看,二来上面的链接有同款图
老规矩,Cookie 放在 A 列即可,Cookie 获取参考 https://www.52pojie.cn/forum.php?mod=viewthread&tid=1904839&highlight=%BF%E4%BF%CB
由于论坛放不出推送代码,可以查看 https://registry.npmmirror.com/@asunajs/dist/latest/files/quark.wps.js
// ../../core/quark/api.ts
function createApi(http) {
let driveUrl = 'https://drive-m.quark.cn/1/clouddrive/capacity/growth';
return {
getInfo: function () {
return http.get(`${driveUrl}/info?pr=ucpro&fr=pc&uc_param_str=`);
},
sign: function () {
return http.post(`${driveUrl}/sign?pr=ucpro&fr=pc&uc_param_str=`, {
sign_cyclic: !0,
});
},
};
}
// ../../core/quark/index.ts
function getInfo($) {
try {
let { data, code, status, message } = $.api.getInfo();
if (code !== 0) {
$.logger.info('获取用户信息失败', code, status, message);
return;
}
return data.cap_sign;
} catch (error) {
$.logger.error('获取用户信息异常', error.message);
}
}
function signIn($) {
try {
let { data, code, status, message } = $.api.sign();
if (code !== 0) {
$.logger.info('签到失败', code, status, message);
return;
}
return data.sign_daily_reward;
} catch (error) {
$.logger.error('签到异常', error.message);
}
}
function run($) {
try {
let info = getInfo($);
if (!info) {
$.logger.error('登录失败');
return;
}
let { sign_progress, sign_rewards, sign_target, sign_daily } = info;
if (sign_daily) {
$.logger.info(
`\u4ECA\u65E5\u5DF2\u7B7E\u5230${
sign_rewards[sign_progress - 1].name
}\uFF0C\u8FDE\u7B7E\u8FDB\u5EA6${sign_progress}/${sign_target}\u3002`
);
return;
}
let dailyReward = signIn($);
dailyReward &&
$.logger.info(
`\u7B7E\u5230\u6210\u529F\uFF0C\u83B7\u5F97${
dailyReward / 1048576
}M\uFF0C\u8FDE\u7B7E\u8FDB\u5EA6${
sign_progress + 1
}/${sign_target}\u3002`
);
} catch (error) {
$.logger.error('运行异常', error.message);
}
}
// ../../packages/utils-pure/index.ts
function createLogger(options) {
let wrap = (type, ...args) => {
if (options && options.pushData) {
let msg = args.reduce((str, cur) => `${str} ${cur}`, '').substring(1);
options.pushData.push({
msg: msg,
type: type,
date: /* @__PURE__ */ new Date(),
});
}
console[type](...args);
};
return {
info: (...args) => wrap('info', ...args),
error: (...args) => wrap('error', ...args),
debug: (...args) => wrap('info', ...args),
};
}
// ../utils/index.ts
function createSimpleRequest(headers) {
return {
get: (url) =>
HTTP.get(url, {
headers: headers,
}).json(),
post: (url, data) =>
HTTP.post(url, typeof data == 'string' ? data : JSON.stringify(data), {
headers: headers,
}).json(),
};
}
// index.ts
function main(cookie, option) {
if (!cookie) return;
let logger = createLogger({
pushData: option && option.pushData,
}),
$ = {
api: createApi(
createSimpleRequest({
'content-type': 'application/json',
'user-agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0',
cookie: cookie,
})
),
logger: logger,
sleep: Time.sleep,
};
$.logger.info('--------------'), run($);
}
var sheet =
Application.Sheets.Item('夸克网盘') ||
Application.Sheets.Item('quark') ||
ActiveSheet,
usedRange = sheet.UsedRange,
columnA = sheet.Columns('A'),
len = usedRange.Row + usedRange.Rows.Count - 1,
pushData = [];
for (let i = 1; i <= len; i++) {
let cell = columnA.Rows(i);
cell.Text &&
(console.log(`\u6267\u884C\u7B2C ${i} \u884C`),
main(cell.Text, {
pushData: pushData,
}));
}