小米运动助手
// ==UserScript==
// @name 小米运动助手
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.3.0
// @description 通过小米运动账号修改步数,可同步至微信、支付宝
// @author shuaima
// @crontab * 12 once * *
// @grant GM_xmlhttpRequest
// @grant GM_notification
// @grant GM_getValue
// @grant GM_log
// @connect api.leafone.cn
// ==/UserScript==
/* ==UserConfig==
peizhi:
user:
title: 账号
description: 即手机号或邮箱
password:
title: 密码
description: 账号密码
password: true
step:
title: 微信步数
description: 如:59999
type: number
==/UserConfig== */
return new Promise((resolve, reject) => {
// 替换为你的手机号、邮箱和密码(声明:必须有小米运动账号Zepp Life)
//这里填入账号密码
var user = GM_getValue('peizhi.user');
var password = GM_getValue('peizhi.password');
// 修改你每天走路理想的步数(声明:最好小于99999)
//随机生成要显示的步数(在45000到59999之间的整数)
var step = Math.floor(Math.random() * (59999 - 45000 + 1)) + 45000;
if (GM_getValue('peizhi.step')) {
step = GM_getValue('peizhi.step')
};
// 构造请求URL
var url = "https://api.leafone.cn/api/misport?user=" + user + "&password=" + password + "&step=" + step;
console.log(url);
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: xhr => {
let data = JSON.parse(xhr.responseText)
if(data.code === 200){
GM_notification({
title: "小米运动",
image: "https://img2.imgtp.com/2024/04/26/pOaAXDlf.png",
text: "步数已修改" + step,
})
}else{
GM_notification({
title: "小米运动",
image: "https://img2.imgtp.com/2024/04/26/pOaAXDlf.png",
text: data.msg,
})
}
},
onerror: xhr => {
GM_notification("接口请求失败")
}
})
});