用 Python 修改微信(支付宝)运动步数,轻松 TOP1

Python乱炖

共 3463字,需浏览 7分钟

 · 2020-11-06

点击上方“Python乱炖”,选择“星标”公众号


号外:


阅读文本大概需要 5 分钟



2c10756d6c9d2335dcbb67bad3af13cd.webp


大家好,我是pk哥

今天分享的文章让你霸屏微信运动,横扫支付宝榜单


1


   

项目意义

如果你想在支付宝蚂蚁森林收集很多能量种树,为环境绿化出一份力量,又或者是想每天称霸微信运动排行榜装逼,却不想出门走路,那么该 Python 脚本可以帮你实现。

2


   

实现方法

手机安装第三方软件乐心健康,注册账号登录,将运动数据同步到微信和支付宝。用 Python 脚本远程修改乐心健康当前登录账号的步数即可。

第一步:在手机上安装乐心健康 app。


a358b70ae298e692d060c2b72c39538e.webp安卓版下载地址: ( http://app.mi.com/details?id=gz.lifesense.weidong )

苹果版下载地址:( https://apps.apple.com/us/app/lifesense-health/id1479525632 )

第二步:注册账号登录,并设置登录密码。

90f7c383cc068cd34d4869a4293e0764.webp


第三步:完成第三方同步,将运动数据同步到微信和支付宝。

ccfc92ca2729a0a5ac9fad0a07b2120f.webp


第四步:运行 Python 脚本,修改乐心健康步数。

1897bcc0a0b159a7dd45a7c246f12679.webp


54d0a8700918c7a12997c8a247fe725a.webp
fb69ee3659c335e2554cd4e9afab30a1.webp


3


   

Python 代码

程序设定是每天 7 点自动修改步数,在下面脚本对应的位置替换填入乐心健康账号、乐心健康密码、修改步数,然后运行程序。修改步数推荐设置范围是 30000 至 90000,步数值太大会导致修改不成功。如果想改变第二天自动修改步数的时间,请修改图示位置的 25200,+25200 代表第二天 0 点后加上的秒数,也就是 7x60x60,即 7 小时,根据自己的需要修改即可。如果每天都要修改步数,那么让程序一直保持运行即可。

注意:运行程序会立刻修改当天的步数,自动修改步数是从程序保持运行的第二天开始。

bc91cb3b40f25072def277fe85b7b6fa.webp59d723176a763e9ae28fd5868bcd6206.webp
部分源码如下。

# -*- coding: utf-8 -*-
import requests
import json
import hashlib
import time
import datetime


class LexinSport:
    def __init__(self, username, password, step):
        self.username = username
        self.password = password
        self.step = step

    # 登录
    def login(self):
        url = 'https://sports.lifesense.com/sessions_service/login?systemType=2&version=4.6.7'
        data = {'loginName': self.username, 'password': hashlib.md5(self.password.encode('utf8')).hexdigest(),
                'clientId''49a41c9727ee49dda3b190dc907850cc''roleType': 0, 'appType': 6}
        headers = {
            'Content-Type''application/json; charset=utf-8',
            'User-Agent''Dalvik/2.1.0 (Linux; U; Android 7.1.2; LIO-AN00 Build/LIO-AN00)'
        }
        response_result = requests.post(url, data=json.dumps(data), headers=headers)
        status_code = response_result.status_code
        response_text = response_result.text
        # print('登录状态码:%s' % status_code)
        # print('登录返回数据:%s' % response_text)
        if status_code == 200:
            response_text = json.loads(response_text)
            user_id = response_text['data']['userId']
            access_token = response_text['data']['accessToken']
            return user_id, access_token
        else:
            return '登录失败'

    # 修改步数
    def change_step(self):
        # 登录结果
        login_result = self.login()
        if login_result == '登录失败':
            return '登录失败'
        else:
            url = 'https://sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?systemType=2&version=4.6.7'
            data = {'list': [{'DataSource': 2, 'active': 1, 'calories': int(self.step/4), 'dataSource': 2,
                              'deviceId''M_NULL''distance': int(self.step/3), 'exerciseTime': 0, 'isUpload': 0,
                              'measurementTime': time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': 0, 'step': self.step,
                              'type': 2, 'updated': int(round(time.time() * 1000)), 'userId': login_result[0]}]}
            headers = {
                'Content-Type''application/json; charset=utf-8',
                'Cookie''accessToken=%s' % login_result[1]
            }
            response_result = requests.post(url, data=json.dumps(data), headers=headers)
            status_code = response_result.status_code
            # response_text = response_result.text
            # print('修改步数状态码:%s' % status_code)
            # print('修改步数返回数据:%s' % response_text)
            if status_code == 200:
                return '修改步数为【%s】成功' % self.step
            else:
                return '修改步数失败'




作者:Tsubasa_Ou

https://blog.csdn.net/jiangfan2017/article/details/108984940



2a2731e0b16d19f12537d15ba6bc8bcb.webp


扫一扫下面的二维码一起学习进步哦~


14ad2bff3665eaa3d0793c4a473b2972.webp

“扫一扫回复:学习资料”


浏览 32
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报