mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 21:58:03 +08:00
🔨 添加【AcFun】点赞、弹幕、投币任务;
🔨 修改默认定时任务执行时间,减少 clone 次数
This commit is contained in:
parent
785407115f
commit
b2f023f3e7
@ -11,9 +11,10 @@ urllib3.disable_warnings()
|
||||
class AcFunCheckIn:
|
||||
def __init__(self, check_item: dict):
|
||||
self.check_item = check_item
|
||||
self.contentid = "27259341"
|
||||
|
||||
@staticmethod
|
||||
def sign(session, phone, password):
|
||||
def get_cookies(session, phone, password):
|
||||
url = "https://id.app.acfun.cn/rest/app/login/signin"
|
||||
headers = {
|
||||
"Host": "id.app.acfun.cn",
|
||||
@ -29,20 +30,89 @@ class AcFunCheckIn:
|
||||
auth_key = str(response.json().get("auth_key"))
|
||||
if acpasstoken and auth_key:
|
||||
cookies = {"acPasstoken": acpasstoken, "auth_key": auth_key}
|
||||
headers = {"acPlatform": "IPHONE"}
|
||||
response = session.post(
|
||||
url="https://api-ipv6.acfunchina.com/rest/app/user/signIn", headers=headers, cookies=cookies
|
||||
)
|
||||
return response.json().get("msg")
|
||||
return cookies
|
||||
else:
|
||||
return "登录失败!请检查密码是否正确!"
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def get_token(session, cookies):
|
||||
url = "https://id.app.acfun.cn/rest/web/token/get"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
response = session.post(url=url, cookies=cookies, data="sid=acfun.midground.api", headers=headers)
|
||||
return response.json().get("acfun.midground.api_st")
|
||||
|
||||
def get_video(self, session):
|
||||
url = "https://api-ipv6.acfunchina.com/rest/app/rank/channel"
|
||||
data = "channelId=0&rankPeriod=DAY"
|
||||
response = session.post(url=url, data=data)
|
||||
self.contentid = response.json().get("rankList")[0].get("contentId")
|
||||
return self.contentid
|
||||
|
||||
@staticmethod
|
||||
def sign(session, cookies):
|
||||
headers = {"acPlatform": "IPHONE"}
|
||||
response = session.post(
|
||||
url="https://api-ipv6.acfunchina.com/rest/app/user/signIn", headers=headers, cookies=cookies
|
||||
)
|
||||
return response.json().get("msg")
|
||||
|
||||
@staticmethod
|
||||
def danmu(session, cookies):
|
||||
url = "https://api-ipv6.acfunchina.com/rest/app/new-danmaku/add"
|
||||
body = "body=sitoi&color=16777215&id=27259341&mode=1&position=5019&size=25&subChannelId=84&subChannelName=%E4%B8%BB%E6%9C%BA%E5%8D%95%E6%9C%BA&type=douga&videoId=22898696"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
response = session.post(url=url, headers=headers, cookies=cookies, data=body)
|
||||
if response.json().get("result") == 0:
|
||||
msg = "弹幕成功"
|
||||
else:
|
||||
msg = "弹幕失败"
|
||||
return msg
|
||||
|
||||
def throwbanana(self, session, cookies):
|
||||
url = "https://api-ipv6.acfunchina.com/rest/app/banana/throwBanana"
|
||||
body = f"count=1&resourceId={self.contentid}&resourceType=2"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
response = session.post(url=url, headers=headers, cookies=cookies, data=body)
|
||||
if response.json().get("result") == 0:
|
||||
msg = "香蕉成功"
|
||||
else:
|
||||
msg = "香蕉失败"
|
||||
return msg
|
||||
|
||||
def like(self, session, token):
|
||||
like_url = "https://api.kuaishouzt.com/rest/zt/interact/add"
|
||||
unlike_url = "https://api.kuaishouzt.com/rest/zt/interact/delete"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
cookies = {"acfun.midground.api_st": token, "kpn": "ACFUN_APP"}
|
||||
body = f"interactType=1&objectId={self.contentid}&objectType=2&subBiz=mainApp"
|
||||
response = session.post(url=like_url, headers=headers, cookies=cookies, data=body)
|
||||
session.post(url=unlike_url, headers=headers, cookies=cookies, data=body)
|
||||
if response.json().get("result") == 1:
|
||||
msg = "点赞成功"
|
||||
else:
|
||||
msg = "点赞失败"
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
phone = self.check_item.get("acfun_phone")
|
||||
password = self.check_item.get("acfun_password")
|
||||
session = requests.session()
|
||||
sign_msg = self.sign(session=session, phone=phone, password=password)
|
||||
msg = f"帐号信息: {phone}\n签到状态: {sign_msg}"
|
||||
self.get_video(session=session)
|
||||
cookies = self.get_cookies(session=session, phone=phone, password=password)
|
||||
token = self.get_token(session=session, cookies=cookies)
|
||||
sign_msg = self.sign(session=session, cookies=cookies)
|
||||
like_msg = self.like(session=session, token=token)
|
||||
danmu_msg = self.danmu(session=session, cookies=cookies)
|
||||
throwbanana_msg = self.throwbanana(session=session, cookies=cookies)
|
||||
msg = f"帐号信息: {phone}\n签到状态: {sign_msg}\n点赞任务: {like_msg}\n" f"弹幕任务: {danmu_msg}\n香蕉任务: {throwbanana_msg}"
|
||||
return msg
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#必须要的默认定时任务请勿删除
|
||||
52 */1 * * * sh /dailycheckin/docker/default_task.sh >> /dailycheckin/logs/default_task.log 2>&1
|
||||
0 */12 * * * sh /dailycheckin/docker/default_task.sh >> /dailycheckin/logs/default_task.log 2>&1
|
||||
# 每天的 23:50 分清理一次日志
|
||||
50 23 */1 * * rm -rf /dailycheckin/logs/*.log
|
||||
50 23 */2 * * rm -rf /dailycheckin/logs/*.log
|
||||
|
||||
|
||||
##############每日签到一次任务##############
|
||||
|
Loading…
Reference in New Issue
Block a user