mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 21:58:03 +08:00
完善通知代码
This commit is contained in:
parent
ff1fac3c21
commit
51e18ce69a
@ -1,40 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
from urllib import parse
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class BaiduUrlSubmit:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, baidu_url_submit_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, baidu_url_submit_list: list):
|
||||
self.baidu_url_submit_list = baidu_url_submit_list
|
||||
|
||||
def message_to_dingtalk(self, content: str):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def url_submit(self, data_url: str, submit_url: str, times: int = 100) -> str:
|
||||
@staticmethod
|
||||
def url_submit(data_url: str, submit_url: str, times: int = 100) -> str:
|
||||
site = parse.parse_qs(parse.urlsplit(submit_url).query).get("site")[0]
|
||||
urls_data = requests.get(url=data_url)
|
||||
remian = 100000
|
||||
@ -54,6 +31,7 @@ class BaiduUrlSubmit:
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for baidu_url_submit in self.baidu_url_submit_list:
|
||||
data_url = baidu_url_submit.get("data_url")
|
||||
submit_url = baidu_url_submit.get("submit_url")
|
||||
@ -61,18 +39,12 @@ class BaiduUrlSubmit:
|
||||
if data_url and submit_url:
|
||||
msg = self.url_submit(data_url=data_url, submit_url=submit_url, times=times)
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
baidu_url_submit_list = data.get("baidu_url_submit", [])
|
||||
BaiduUrlSubmit(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
baidu_url_submit_list=baidu_url_submit_list,
|
||||
).main()
|
||||
_baidu_url_submit_list = data.get("baidu_url_submit", [])
|
||||
BaiduUrlSubmit(baidu_url_submit_list=_baidu_url_submit_list).main()
|
||||
|
86
index.py
86
index.py
@ -1,5 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
import requests
|
||||
|
||||
from baidu_url_submit import BaiduUrlSubmit
|
||||
from iqiyi import IQIYICheckIn
|
||||
@ -10,69 +17,78 @@ from vqq import VQQCheckIn
|
||||
from youdao import YouDaoCheckIn
|
||||
|
||||
|
||||
def message_to_dingtalk(dingtalk_secret, dingtalk_access_token, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
|
||||
def main_handler(event, context):
|
||||
start_time = time.time()
|
||||
with open("config.json", "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
|
||||
content_list = []
|
||||
iqiyi_cookie_list = data.get("iqiyi", [])
|
||||
if iqiyi_cookie_list:
|
||||
IQIYICheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
iqiyi_cookie_list=iqiyi_cookie_list,
|
||||
).main()
|
||||
msg_list = IQIYICheckIn(iqiyi_cookie_list=iqiyi_cookie_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
baidu_url_submit_list = data.get("baidu_url_submit", [])
|
||||
if baidu_url_submit_list:
|
||||
BaiduUrlSubmit(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
baidu_url_submit_list=baidu_url_submit_list,
|
||||
).main()
|
||||
msg_list = BaiduUrlSubmit(baidu_url_submit_list=baidu_url_submit_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
vqq_cookie_list = data.get("vqq", [])
|
||||
if vqq_cookie_list:
|
||||
VQQCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
vqq_cookie_list=vqq_cookie_list,
|
||||
).main()
|
||||
msg_list = VQQCheckIn(vqq_cookie_list=vqq_cookie_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
youdao_cookie_list = data.get("youdao", [])
|
||||
if youdao_cookie_list:
|
||||
YouDaoCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
youdao_cookie_list=youdao_cookie_list,
|
||||
).main()
|
||||
msg_list = YouDaoCheckIn(youdao_cookie_list=youdao_cookie_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
pojie_cookie_list = data.get("52pojie", [])
|
||||
if pojie_cookie_list:
|
||||
PojieCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
pojie_cookie_list=pojie_cookie_list,
|
||||
).main()
|
||||
msg_list = PojieCheckIn(pojie_cookie_list=pojie_cookie_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
kgqq_cookie_list = data.get("kgqq", [])
|
||||
if kgqq_cookie_list:
|
||||
KGQQCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
kgqq_cookie_list=kgqq_cookie_list,
|
||||
).main()
|
||||
msg_list = KGQQCheckIn(kgqq_cookie_list=kgqq_cookie_list).main()
|
||||
content_list += msg_list
|
||||
|
||||
music163_account_list = data.get("music163", [])
|
||||
if music163_account_list:
|
||||
Music163CheckIn(
|
||||
msg_list = Music163CheckIn(music163_account_list=music163_account_list, ).main()
|
||||
content_list += msg_list
|
||||
|
||||
use_time_info = f"\n\n本次任务使用时间: {time.time() - start_time} 秒"
|
||||
content_list.append(use_time_info)
|
||||
content = "\n-----------------------------\n".join(content_list)
|
||||
print(content)
|
||||
if dingtalk_access_token and dingtalk_secret:
|
||||
message_to_dingtalk(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
music163_account_list=music163_account_list,
|
||||
).main()
|
||||
content=content
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main_handler(event=None, context=None)
|
||||
|
@ -1,20 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class IQIYICheckIn:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, iqiyi_cookie_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, iqiyi_cookie_list):
|
||||
self.iqiyi_cookie_list = iqiyi_cookie_list
|
||||
self.task_list = []
|
||||
self.growth_task = 0
|
||||
@ -25,24 +19,8 @@ class IQIYICheckIn:
|
||||
p00003 = re.findall(r"P00003=(.*?);", cookie)[0]
|
||||
return p00001, p00003
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def user_information(self, p00001):
|
||||
@staticmethod
|
||||
def user_information(p00001):
|
||||
"""
|
||||
用户信息查询
|
||||
"""
|
||||
@ -63,12 +41,14 @@ class IQIYICheckIn:
|
||||
f"升级需成长值: {distance}\n今日成长值: +{today_growth_value}\nVIP 到期时间: {deadline}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = res.json()
|
||||
else:
|
||||
msg = res.json()
|
||||
return msg
|
||||
|
||||
def sign(self, p00001):
|
||||
@staticmethod
|
||||
def sign(p00001):
|
||||
"""
|
||||
VIP 签到
|
||||
"""
|
||||
@ -85,6 +65,7 @@ class IQIYICheckIn:
|
||||
rouund_day = 28 if continue_sign_days_sum % 28 == 0 else continue_sign_days_sum % 28
|
||||
msg = f"+{growth}成长值\n连续签到: {continue_sign_days_sum}天\n签到周期: {rouund_day}天/{reward_day}天"
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = res.json()["data"]["signInfo"]["msg"]
|
||||
else:
|
||||
msg = res.json()["msg"]
|
||||
@ -136,7 +117,8 @@ class IQIYICheckIn:
|
||||
msg = f"+{self.growth_task}成长值"
|
||||
return msg
|
||||
|
||||
def draw(self, draw_type, p00001, p00003):
|
||||
@staticmethod
|
||||
def draw(draw_type, p00001, p00003):
|
||||
"""
|
||||
查询抽奖次数(必),抽奖
|
||||
:param draw_type: 类型。0 查询次数;1 抽奖
|
||||
@ -172,10 +154,12 @@ class IQIYICheckIn:
|
||||
try:
|
||||
msg = res.json().get("kv", {}).get("msg")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = res.json()["errorReason"]
|
||||
return {"status": False, "msg": msg, "chance": 0}
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for iqiyi_cookie in self.iqiyi_cookie_list:
|
||||
p00001, p00003 = self.parse_cookie(iqiyi_cookie.get("iqiyi_cookie"))
|
||||
sign_msg = self.sign(p00001=p00001)
|
||||
@ -191,22 +175,16 @@ class IQIYICheckIn:
|
||||
task_msg = self.query_user_task(p00001=p00001).get_task_rewards(p00001=p00001)
|
||||
user_msg = self.user_information(p00001=p00001)
|
||||
msg = (
|
||||
f"【爱奇艺等级】\n{user_msg}\n-----------------------------\n"
|
||||
f"【爱奇艺签到】\n签到奖励: {sign_msg}\n任务奖励: {task_msg}\n抽奖奖励: {draw_msg}"
|
||||
f"【爱奇艺签到】\n{user_msg}\n"
|
||||
f"签到奖励: {sign_msg}\n任务奖励: {task_msg}\n抽奖奖励: {draw_msg}"
|
||||
)
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
iqiyi_cookie_list = data.get("iqiyi", [])
|
||||
IQIYICheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
iqiyi_cookie_list=iqiyi_cookie_list,
|
||||
).main()
|
||||
_iqiyi_cookie_list = data.get("iqiyi", [])
|
||||
IQIYICheckIn(iqiyi_cookie_list=_iqiyi_cookie_list).main()
|
||||
|
60
kgqq/kgqq.py
60
kgqq/kgqq.py
@ -1,40 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class KGQQCheckIn:
|
||||
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, kgqq_cookie_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, kgqq_cookie_list):
|
||||
self.kgqq_cookie_list = kgqq_cookie_list
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def sign(self, kgqq_cookie):
|
||||
@staticmethod
|
||||
def sign(kgqq_cookie):
|
||||
headers = {"Cookie": kgqq_cookie}
|
||||
uid = kgqq_cookie.split("; ")
|
||||
t_uuid = ""
|
||||
@ -42,7 +19,8 @@ class KGQQCheckIn:
|
||||
if i.find("uid=") >= 0:
|
||||
t_uuid = i.split("=")[1]
|
||||
proto_profile_url = "https://node.kg.qq.com/webapp/proxy?ns=proto_profile&cmd=profile.getProfile&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnByb2ZpbGVfd2ViYXBwSmNlJTIyJTJDJTIyY21kTmFtZSUyMiUzQSUyMlByb2ZpbGVHZXQlMjIlMkMlMjJhcHBpZCUyMiUzQTEwMDA2MjYlMkMlMjJkY2FwaSUyMiUzQSU3QiUyMmludGVyZmFjZUlkJTIyJTNBMjA1MzU5NTk3JTdEJTJDJTIybDVhcGklMjIlM0ElN0IlMjJtb2RpZCUyMiUzQTI5NDAxNyUyQyUyMmNtZCUyMiUzQTI2MjE0NCU3RCUyQyUyMmlwJTIyJTNBJTIyMTAwLjExMy4xNjIuMTc4JTIyJTJDJTIycG9ydCUyMiUzQSUyMjEyNDA2JTIyJTdE&t_uUid={0}".format(
|
||||
t_uuid)
|
||||
t_uuid
|
||||
)
|
||||
|
||||
url_list = (
|
||||
[
|
||||
@ -90,9 +68,11 @@ class KGQQCheckIn:
|
||||
url=proto_music_station_url + str(g_tk_openkey), headers=headers
|
||||
)
|
||||
vct_music_cards = proto_music_station_resp.json()["data"]["message.batch_get_music_cards"][
|
||||
"vctMusicCards"]
|
||||
"vctMusicCards"
|
||||
]
|
||||
vct_music_cards_list = sorted(vct_music_cards, key=lambda x: x["stReward"]["uFlowerNum"], reverse=True)[
|
||||
0]
|
||||
0
|
||||
]
|
||||
str_ugc_id = vct_music_cards_list["strUgcId"]
|
||||
str_key = vct_music_cards_list["strKey"]
|
||||
url = str_ugc_id + "&t_strKey=" + str_key
|
||||
@ -114,23 +94,19 @@ class KGQQCheckIn:
|
||||
return kg_message
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for kgqq_cookie in self.kgqq_cookie_list:
|
||||
kgqq_cookie = kgqq_cookie.get("kgqq_cookie")
|
||||
msg = self.sign(kgqq_cookie=kgqq_cookie)
|
||||
msg = f"【全民K歌签到】\n获取鲜花: {msg}"
|
||||
o_cookie = re.findall(r"o_cookie=(.*?);", kgqq_cookie)[0]
|
||||
msg = f"【全民K歌签到】\n帐号信息: {o_cookie}\n获取鲜花: {msg}"
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
kgqq_cookie_list = data.get("kgqq", [])
|
||||
KGQQCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
kgqq_cookie_list=kgqq_cookie_list,
|
||||
).main()
|
||||
_kgqq_cookie_list = data.get("kgqq", [])
|
||||
KGQQCheckIn(kgqq_cookie_list=_kgqq_cookie_list).main()
|
||||
|
@ -1,40 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
import requests
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
|
||||
|
||||
class Music163CheckIn:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, music163_account_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, music163_account_list):
|
||||
self.music163_account_list = music163_account_list
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
@staticmethod
|
||||
def md5(text):
|
||||
hl = hashlib.md5()
|
||||
@ -44,18 +22,18 @@ class Music163CheckIn:
|
||||
@staticmethod
|
||||
def encrypt(key, text):
|
||||
backend = default_backend()
|
||||
cipher = Cipher(algorithms.AES(key.encode('utf8')), modes.CBC(b'0102030405060708'), backend=backend)
|
||||
cipher = Cipher(algorithms.AES(key.encode("utf8")), modes.CBC(b"0102030405060708"), backend=backend)
|
||||
encryptor = cipher.encryptor()
|
||||
length = 16
|
||||
count = len(text.encode('utf-8'))
|
||||
count = len(text.encode("utf-8"))
|
||||
if count % length != 0:
|
||||
add = length - (count % length)
|
||||
else:
|
||||
add = 16
|
||||
pad = chr(add)
|
||||
text1 = text + (pad * add)
|
||||
ciphertext = encryptor.update(text1.encode('utf-8')) + encryptor.finalize()
|
||||
crypted_str = str(base64.b64encode(ciphertext), encoding='utf-8')
|
||||
ciphertext = encryptor.update(text1.encode("utf-8")) + encryptor.finalize()
|
||||
crypted_str = str(base64.b64encode(ciphertext), encoding="utf-8")
|
||||
return crypted_str
|
||||
|
||||
def protect(self, text):
|
||||
@ -152,25 +130,20 @@ class Music163CheckIn:
|
||||
return sign_msg, music_count_msg
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for music163_account in self.music163_account_list:
|
||||
phone = music163_account.get("music163_phone")
|
||||
password = music163_account.get("music163_password")
|
||||
session = requests.session()
|
||||
sign_msg, music_count_msg = self.sign(session=session, phone=phone, password=password)
|
||||
msg = f"【网易云音乐签到】\n签到奖励: {sign_msg}\n刷单数量: {music_count_msg}"
|
||||
msg = f"【网易云音乐签到】\n帐号信息: {phone}\n签到状态: {sign_msg}\n刷歌数量: {music_count_msg}"
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
music163_account_list = data.get("music163", [])
|
||||
Music163CheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
music163_account_list=music163_account_list,
|
||||
).main()
|
||||
_music163_account_list = data.get("music163", [])
|
||||
Music163CheckIn(music163_account_list=_music163_account_list).main()
|
||||
|
@ -1,71 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class PojieCheckIn:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, pojie_cookie_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, pojie_cookie_list):
|
||||
self.pojie_cookie_list = pojie_cookie_list
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def sign(self, headers):
|
||||
@staticmethod
|
||||
def sign(headers):
|
||||
url = "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2"
|
||||
res = requests.get(url=url, headers=headers)
|
||||
if "任务已完成" in res.content.decode("gbk"):
|
||||
msg = '任务已完成'
|
||||
msg = "任务已完成"
|
||||
elif "本期您已申请过此任务" in res.content.decode("gbk"):
|
||||
msg = '签到过了'
|
||||
msg = "签到过了"
|
||||
elif "需要先登录" in res.content.decode("gbk"):
|
||||
msg = '未登录,请检查 Cookies'
|
||||
msg = "未登录,请检查 Cookies"
|
||||
else:
|
||||
print("(52)签到错误信息", res.content.decode("gbk"))
|
||||
msg = "未知错误,检查日志"
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for pojie_cookie in self.pojie_cookie_list:
|
||||
pojie_cookie = pojie_cookie.get("pojie_cookie")
|
||||
uid = re.findall(r"htVD_2132_lastcheckfeed=(.*?);", pojie_cookie)[0].split("%7C")[0]
|
||||
headers = {"Cookie": pojie_cookie}
|
||||
msg = self.sign(headers=headers)
|
||||
msg = f"【吾爱破解签到】\n签到状态: {msg}"
|
||||
msg = f"【吾爱破解签到】\n帐号信息: {uid}\n签到状态: {msg}"
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
pojie_cookie_list = data.get("52pojie", [])
|
||||
PojieCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
pojie_cookie_list=pojie_cookie_list,
|
||||
).main()
|
||||
_pojie_cookie_list = data.get("52pojie", [])
|
||||
PojieCheckIn(pojie_cookie_list=_pojie_cookie_list).main()
|
||||
|
51
vqq/vqq.py
51
vqq/vqq.py
@ -1,40 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class VQQCheckIn:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, vqq_cookie_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, vqq_cookie_list):
|
||||
self.vqq_cookie_list = vqq_cookie_list
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def sign_once(self, session, headers):
|
||||
@staticmethod
|
||||
def sign_once(session, headers):
|
||||
url = "http://v.qq.com/x/bu/mobile_checkin?isDarkMode=0&uiType=REGULAR"
|
||||
res = session.get(url=url, headers=headers)
|
||||
match = re.search(r'isMultiple" />\s+(.*?)\s+<', res.text)
|
||||
@ -45,7 +23,8 @@ class VQQCheckIn:
|
||||
msg = "签到失败(可能已签到)"
|
||||
return msg
|
||||
|
||||
def sign_twice(self, session, headers):
|
||||
@staticmethod
|
||||
def sign_twice(session, headers):
|
||||
this_time = int(round(time.time() * 1000))
|
||||
url = "https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=" + str(this_time)
|
||||
res = session.get(url=url, headers=headers)
|
||||
@ -58,26 +37,22 @@ class VQQCheckIn:
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for vqq_cookie in self.vqq_cookie_list:
|
||||
vqq_cookie = vqq_cookie.get("vqq_cookie")
|
||||
session = requests.session()
|
||||
headers = {"Cookie": vqq_cookie}
|
||||
o_cookie = re.findall(r"o_cookie=(.*?);", vqq_cookie)[0]
|
||||
sign_once_msg = self.sign_once(session=session, headers=headers)
|
||||
sign_twice_msg = self.sign_twice(session=session, headers=headers)
|
||||
msg = f"【腾讯视频签到】\n签到奖励1: {sign_once_msg}\n签到奖励2: {sign_twice_msg}"
|
||||
msg = f"【腾讯视频签到】\n用户信息: {o_cookie}\n签到奖励1: {sign_once_msg}\n签到奖励2: {sign_twice_msg}"
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
vqq_cookie_list = data.get("vqq", [])
|
||||
VQQCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
vqq_cookie_list=vqq_cookie_list,
|
||||
).main()
|
||||
_vqq_cookie_list = data.get("vqq", [])
|
||||
VQQCheckIn(vqq_cookie_list=_vqq_cookie_list).main()
|
||||
|
@ -1,39 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class YouDaoCheckIn:
|
||||
def __init__(self, dingtalk_secret, dingtalk_access_token, youdao_cookie_list):
|
||||
self.dingtalk_secret = dingtalk_secret
|
||||
self.dingtalk_access_token = dingtalk_access_token
|
||||
def __init__(self, youdao_cookie_list):
|
||||
self.youdao_cookie_list = youdao_cookie_list
|
||||
|
||||
def message_to_dingtalk(self, content):
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
secret_enc = self.dingtalk_secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, self.dingtalk_secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
|
||||
send_data = {"msgtype": "text", "text": {"content": content}}
|
||||
requests.post(
|
||||
url="https://oapi.dingtalk.com/robot/send?access_token={0}×tamp={1}&sign={2}".format(
|
||||
self.dingtalk_access_token, timestamp, sign
|
||||
),
|
||||
headers={"Content-Type": "application/json", "Charset": "UTF-8"},
|
||||
data=json.dumps(send_data),
|
||||
)
|
||||
return content
|
||||
|
||||
def sign(self, headers):
|
||||
@staticmethod
|
||||
def sign(headers):
|
||||
ad_space = 0
|
||||
url = "https://note.youdao.com/yws/api/daupromotion?method=sync"
|
||||
res = requests.post(url=url, headers=headers)
|
||||
@ -58,24 +36,21 @@ class YouDaoCheckIn:
|
||||
return youdao_message
|
||||
|
||||
def main(self):
|
||||
msg_list = []
|
||||
for youdao_cookie in self.youdao_cookie_list:
|
||||
youdao_cookie = youdao_cookie.get("youdao_cookie")
|
||||
ynote_pers = re.findall(r"YNOTE_PERS=(.*?);", youdao_cookie)[0]
|
||||
uid = ynote_pers.split("||")[-2]
|
||||
headers = {"Cookie": youdao_cookie}
|
||||
msg = self.sign(headers=headers)
|
||||
msg = f"【有道云笔记签到】\n获取空间: {msg}"
|
||||
msg = f"【有道云笔记签到】\n帐号信息: {uid}\n获取空间: {msg}"
|
||||
print(msg)
|
||||
if self.dingtalk_secret and self.dingtalk_access_token:
|
||||
self.message_to_dingtalk(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
dingtalk_secret = data.get("dingtalk", {}).get("dingtalk_secret")
|
||||
dingtalk_access_token = data.get("dingtalk", {}).get("dingtalk_access_token")
|
||||
youdao_cookie_list = data.get("youdao", [])
|
||||
YouDaoCheckIn(
|
||||
dingtalk_secret=dingtalk_secret,
|
||||
dingtalk_access_token=dingtalk_access_token,
|
||||
youdao_cookie_list=youdao_cookie_list,
|
||||
).main()
|
||||
_youdao_cookie_list = data.get("youdao", [])
|
||||
YouDaoCheckIn(youdao_cookie_list=_youdao_cookie_list).main()
|
||||
|
Loading…
Reference in New Issue
Block a user