Python自动完成正雅积分任务,每月可领约一万积分

可在服务器或腾讯云函数使用

仅供学习使用

import random
import requests
import sys

def login(accout, password):
    loginapi = 'https://capp.smartee.cn:9000/cdc/anon/loginWithPassword'
    json = {
        'accountMobile': accout,
        'accountPassword': password
    }
    loginfo = requests.post(url=loginapi, json=json).json()
    return loginfo


# 签到
def sign(accountToken):
    signapi = 'https://xcs.smartee.cn/index.php/api/v1/index/sign_in.html'
    data = {'accountToken': accountToken}
    headers = {'accountToken': accountToken}
    signinfo = requests.post(signapi, data, headers).json()
    if signinfo['body']['status'] == 0:
        sign(accountToken)
    return signinfo


# 日记
def diary(accountToken):
    diaryapi = 'https://capp.smartee.cn:9000/club/diary/saveDiary'
    data = {
        "diaryContent": getContent(),
        "diaryIssueDid": 1,
        "diaryPublicDid": 0,
        "diaryTitle": "打卡",
        "diaryTopicId": "",
        "diaryImagePathList": [getImage()],
        "diaryId": None,
        "diaryLabelIdList": [37, 38]
    }
    headers = {'accountToken': accountToken}
    diaryinfo = requests.post(url=diaryapi, json=data, headers=headers).json()
    return diaryinfo


# 动态
def dynamic(accountToken):
    dynamicapi = 'https://capp.smartee.cn:9000/club/dynamic/saveDynamic'
    headers = {'accountToken': accountToken}
    data = {
        "dynamicIssueDid": 1,
        "dynamicImageList": [getImage()],
        "dynamicPublicDid": 0,
        "dynamicId": None,
        "dynamicLabelList": [37, 38],
        "dynamicContent": getContent(),
        "dynamicTopicId": 0
    }
    dynamicinfo = requests.post(url=dynamicapi, json=data, headers=headers).json()
    return dynamicinfo


# 点赞评论分享
def likecshare(accountToken):
    headers = {'accountToken': accountToken}
    likeapi = 'https://capp.smartee.cn:9000/club/content/updateLike'
    commentapi = 'https://capp.smartee.cn:9000/club/comment/saveComment'
    shareapi = 'https://capp.smartee.cn:9000/club/diary/shareDiary'
    while (True):
        likeinfo = requests.post(url=likeapi, json={"typeDid": 0, "dataId": random.randint(4000, 5200), "status": 1},
                                 headers=headers).json()
        if likeinfo['status'] == 1:
            break
    while (True):
        commentinfo = requests.post(url=commentapi,
                                    json={"dataType": 0, "dataId": random.randint(4000, 5200), "commentContent": "加油"},
                                    headers=headers).json()
        if commentinfo['status'] == 1:
            break
    while (True):
        shareinfo = requests.post(url=shareapi, json={"diaryId": random.randint(4000, 5200), "shareType": 0},
                                  headers=headers).json()
        if shareinfo['status'] == 1:
            break
    # print(likeinfo)
    # print(commentinfo)
    # print(shareinfo)


def getImage():
    images = [
        "mini/20211029/20211029181124740_809986.jpg",
        "tooth/info/20211108130406983_630456.jpg",
        "mini/20211109/20211109000616066_179319.jpg",
        "mini/20211109/20211109141256001_799969.jpg",
        "mini/20211031/20211031182021292_932572.jpg",
        "tooth/info/20210129134225531_588150.jpg",
        "mini/20211029/20211029192354513_382122.jpg",
        "tooth/info/20211029191114277_939831.jpg",
        "tooth/info/20210727085437970_276777.jpg",
        "mini/20211103/20211103182836328_516162.jpg",
        "mini/20211113/20211113233328464_897200.jpg",
        "tooth/info/20210724134428351_532866.jpg",
        "tooth/info/20211030215035024_642868.jpg"
    ]
    image = images[random.randint(0, 12)]
    return image


def getContent():
    content = requests.get('https://api.vvhan.com/api/ian').text
    return content


def send(Qid, msg):
    headers = {"Authorization": "zhuzhu"}
    url = rf'http://1127.0.0.1:5700/send_private_msg?user_id={Qid}&message={msg}'
    # url = rf'http://127.0.0.1:5700/send_private_msg?user_id={Qid}&message={msg}'
    requests.get(url, headers=headers)


users = [
    {
        "account": "",#此处填写账号
        "password": "",#此处填写密码
        "Qid": ""#QQ通知,需自行搭建qq机器人,并修改send函数
    }, {
        "account": "",
        "password": "",
        "Qid": ""
    }
]
for user in users:
    account = user['account']
    password = user['password']
    Qid = user['Qid']
    # 登录
    loginfo = login(account, password)
    if loginfo['status'] == 1:
        username = loginfo['data']['account']['accountName']
        usertoken = loginfo['data']['account']['accountToken']
        # 签到
        sign(usertoken)
        # 日记 2
        diary(usertoken)
        diary(usertoken)
        # 动态 3
        dynamic(usertoken)
        dynamic(usertoken)
        dynamic(usertoken)
        # 点赞评论分享 5
        likecshare(usertoken)
        likecshare(usertoken)
        likecshare(usertoken)
        likecshare(usertoken)
        likecshare(usertoken)
        msg = "正雅隐形牙套\n----账号:" + username + "\n--------积分任务,已完成!!!"
        if Qid:
            send(Qid, msg)
    else:
        msg = "正雅隐形牙套\n----账号:" + username + "\n--------" + loginfo['msg']
        if Qid:
            send(Qid, msg)
sys.exit(0)
最后修改:2022 年 05 月 01 日
如果觉得我的文章对你有用,请随意赞赏