某里网盘签到抽奖java
仅供学习交流,请勿用于非法。jar包
https://wwkc.lanzouf.com/ieitO0w9w1oj
密码:bhcm
打开链接 阿里云盘
控制台输入获取tokenJSON.parse(localStorage.token).refresh_token
package com.example.zhuoxin.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
public class aLi {
private static final String updateAccesssTokenURL = "https://auth.aliyundrive.com/v2/account/token";
private static final String signinURL = "https://member.aliyundrive.com/v1/activity/sign_in_list?_rx-s=mobile";
private static final String rewardURL = "https://member.aliyundrive.com/v1/activity/sign_in_reward?_rx-s=mobile";
private static final RestTemplate re = new RestTemplate();
public static final HttpHeaders headers = new HttpHeaders();
private static final String refresh_token = "";
private static final StringBuffer sb = new StringBuffer();
public static void main(String[] args) {
headers.add("Content-Type", "application/json");
JSONObject updateAccesssDate = new JSONObject();
updateAccesssDate.put("grant_type", "refresh_token");
updateAccesssDate.put("refresh_token", refresh_token);
HttpEntity<String> updateAccesssDateEntity = new HttpEntity<String>(JSONObject.toJSONString(updateAccesssDate), headers);
ResponseEntity<String> updateAccesssDateRep = null;
try {
updateAccesssDateRep = re.postForEntity(updateAccesssTokenURL, updateAccesssDateEntity, String.class);
} catch (RestClientException e) {
sb.append("提示 : TOKEN 失效,请更新 !");
System.out.println(sb);
return;
}
JSONObject UpdateAccesssTokenRep = JSONObject.parseObject(updateAccesssDateRep.getBody());
sb.append("------------------获取个人信息成功--------------------" + "\n");
sb.append("用户名 :" + UpdateAccesssTokenRep.getString("user_name") + "\n");
// sb.append("refresh_token :" + UpdateAccesssTokenRep.getString("refresh_token") + "\n");
// sb.append("access_token :" + UpdateAccesssTokenRep.getString("access_token") + "\n");
headers.add("Authorization", UpdateAccesssTokenRep.getString("access_token"));
JSONObject signinURLDate = new JSONObject();
signinURLDate.put("isReward", false);
HttpEntity<String> signinURLDateEntity = new HttpEntity<String>(JSONObject.toJSONString(signinURLDate), headers);
ResponseEntity<String> signinURLDateRep = null;
JSONObject signinURListRep = null;
try {
signinURLDateRep = re.postForEntity(signinURL, signinURLDateEntity, String.class);
signinURListRep = JSONObject.parseObject(signinURLDateRep.getBody());
} catch (RestClientException e) {
sb.append("提示 : 签到列表获取失败 !");
System.out.println(sb);
return;
}
String signInCount = signinURListRep.getJSONObject("result").getString("signInCount");
JSONArray signInLogs = signinURListRep.getJSONObject("result").getJSONArray("signInLogs");
sb.append("------------------获取签到列表信息成功------------------" + "\n");
sb.append("本月累计签到 :" + signInCount + "\n");
//当天签到信息
JSONObject signDayInLogs = signInLogs.getJSONObject(Integer.valueOf(signInCount) - 1);
//获取未领取奖励列表
for (int i = 0; i < signInLogs.size(); i++) {
if (signInLogs.getJSONObject(i).getString("status").equals("normal") && signInLogs.getJSONObject(i).getString("isReward").equals("false")) {
final String day = signInLogs.getJSONObject(i).getString("day");
JSONObject rewardDate = new JSONObject();
rewardDate.put("signInDay", day);
HttpEntity<String> rewardDateEntity = new HttpEntity<String>(rewardDate.toJSONString(), headers);
ResponseEntity<String> rewardDateRep = null;
JSONObject rewardListDateRep = null;
try {
rewardDateRep = re.postForEntity(rewardURL, rewardDateEntity, String.class);
rewardListDateRep = JSONObject.parseObject(rewardDateRep.getBody());
if (rewardListDateRep.getString("success").equals("true")) {
sb.append("------------------奖励领取成功--------------------" + "\n");
sb.append("奖品名称 :" + rewardListDateRep.getJSONObject("result").getString("name") + "\n");
sb.append("奖品名称 :" + rewardListDateRep.getJSONObject("result").getString("description") + "\n");
sb.append("奖品名称 :" + rewardListDateRep.getJSONObject("result").getString("notice") + "\n");
System.out.println(sb);
return;
}
} catch (RestClientException e) {
sb.append("提示 : 奖励领取失败 !");
System.out.println(sb);
return;
}
}
}
sb.append("------------------当天已领取奖励-------------------" + "\n");
sb.append("奖品名称 :" + signDayInLogs.getJSONObject("reward").getString("name") + "\n");
sb.append("奖品名称 :" + signDayInLogs.getJSONObject("reward").getString("description") + "\n");
System.out.println(sb);
}
} 感谢分享 用chatGPT改成了python代码,多账号登陆签到,就是第一次运行的时候没有显示出签到的奖品名称和描述,有大佬帮看看吗?
import requests
import json
updateAccesssTokenURL = "https://auth.aliyundrive.com/v2/account/token"
signinURL = "https://member.aliyundrive.com/v1/activity/sign_in_list?_rx-s=mobile"
rewardURL = "https://member.aliyundrive.com/v1/activity/sign_in_reward?_rx-s=mobile"
headers = {
"Content-Type": "application/json"
}
accounts = [
{
"refresh_token": "你的token1"
},
{
"refresh_token": "你的token2"
}
]
for account in accounts:
refresh_token = account["refresh_token"]
data = {
"grant_type": "refresh_token",
"refresh_token": refresh_token
}
try:
updateAccesssDateRep = requests.post(updateAccesssTokenURL, headers=headers, data=json.dumps(data))
UpdateAccesssTokenRep = updateAccesssDateRep.json()
except requests.exceptions.RequestException as e:
print("提示 : TOKEN 失效,请更新 !")
continue
print("------------------获取个人信息成功--------------------")
print("用户名 :", UpdateAccesssTokenRep["user_name"])
headers["Authorization"] = UpdateAccesssTokenRep["access_token"]
signinURLDate = {
"isReward": False
}
try:
signinURLDateRep = requests.post(signinURL, headers=headers, data=json.dumps(signinURLDate))
signinURListRep = signinURLDateRep.json()
except requests.exceptions.RequestException as e:
print("提示 : 签到列表获取失败 !")
continue
signInCount = signinURListRep["result"]["signInCount"]
signInLogs = signinURListRep["result"]["signInLogs"]
print("------------------获取签到列表信息成功------------------")
print("本月累计签到 :", signInCount)
signDayInLogs = signInLogs
for log in signInLogs:
if log["status"] == "normal" and log["isReward"] == False:
day = log["day"]
rewardDate = {
"signInDay": day
}
try:
rewardDateRep = requests.post(rewardURL, headers=headers, data=json.dumps(rewardDate))
rewardListDateRep = rewardDateRep.json()
if rewardListDateRep["success"] == "true":
print("------------------奖励领取成功--------------------")
print("奖品名称 :", rewardListDateRep["result"]["name"])
print("奖品描述 :", rewardListDateRep["result"]["description"])
break
except requests.exceptions.RequestException as e:
print("提示 : 奖励领取失败 !")
break
print("------------------当天已领取奖励-------------------")
print("奖品名称 :", signDayInLogs["reward"]["name"])
print("奖品描述 :", signDayInLogs["reward"]["description"])
print()
感谢分享 感谢分享 已下载,谢谢楼主分享 感谢分享 有没有中大奖的:lol 感谢分享 感谢分享 这个有啥用?怎么用?只适合电脑呗{:1_925:}