Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复腾讯云函数功能 #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions dist/SCF_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


# ======== CONSTANT ========
sign_url = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign'
work_url = 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work'
login_url = 'https://www.tsdm39.net/member.php?mod=logging&action=login'
sign_url = 'https://www.tsdm39.com/plugin.php?id=dsu_paulsign:sign'
work_url = 'https://www.tsdm39.com/plugin.php?id=np_cliworkdz:work'
login_url = 'https://www.tsdm39.com/member.php?mod=logging&action=login'

tsdm_domain = ".tsdm39.net"
tsdm_domain = ".tsdm39.com"
s1_domain = "bbs.saraba1st.com"


Expand All @@ -39,7 +39,7 @@ def get_cookies_all():

def get_cookies_by_domain(domain:str):
"""从所有cookie里分离出指定域名的cookie
domain: cookie_list domain, (".tsdm39.net")
domain: cookie_list domain, (".tsdm39.com")
"""
cookies_all = get_cookies_all() # { username: [cookie_list] }
domain_cookies = {}
Expand All @@ -62,7 +62,7 @@ def get_cookies_by_domain(domain:str):
# ======= SIGN ======

sign_page_with_param = \
'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1&inajax=1'
'https://www.tsdm39.com/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1&inajax=1'


def sign_single_post_v2(cookie):
Expand All @@ -72,9 +72,9 @@ def sign_single_post_v2(cookie):
headers = {
'accept': 'text/html, application/xhtml+xml, image/jxr, */*',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko',
'cookie_list': cookie_serialized,
'cookie': cookie_serialized,
'connection': 'Keep-Alive',
'referer': 'https://www.tsdm39.net/home.php?mod=space&do=pm',
'referer': 'https://www.tsdm39.com/home.php?mod=space&do=pm',
'content-type': 'application/x-www-form-urlencoded'
}

Expand All @@ -88,6 +88,7 @@ def sign_single_post_v2(cookie):

sign_response = s.post(sign_page_with_param, data=sign_data, headers=headers)


if "恭喜你签到成功!获得随机奖励" in sign_response.text:
print("签到成功")
return True
Expand All @@ -97,7 +98,9 @@ def sign_single_post_v2(cookie):
print("签到失败: 目前不在签到时间段")
elif "未定义操作" in sign_response.text:
print("%s签到失败, 可能是formhash获取错误" % datetime.now())
print("签到", sign_response.text)
# print("签到", sign_response.text)
elif "您需要先登录才能继续本操作" in sign_response.text:
print("header设置错误")
else:
print("%s======未知原因签到失败, 已保存response=======" % datetime.now())
print("签到", sign_response.text)
Expand All @@ -106,6 +109,7 @@ def sign_single_post_v2(cookie):


def sign_multi_post():
print("loading cookies")
cookies = get_cookies_by_domain(tsdm_domain)

for user in cookies.keys():
Expand Down
17 changes: 8 additions & 9 deletions dist/SCF_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from typing import List

# ======== CONSTANT ========
sign_url = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign'
work_url = 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work'
login_url = 'https://www.tsdm39.net/member.php?mod=logging&action=login'
sign_url = 'https://www.tsdm39.com/plugin.php?id=dsu_paulsign:sign'
work_url = 'https://www.tsdm39.com/plugin.php?id=np_cliworkdz:work'
login_url = 'https://www.tsdm39.com/member.php?mod=logging&action=login'

tsdm_domain = ".tsdm39.net"
tsdm_domain = ".tsdm39.com"
s1_domain = "bbs.saraba1st.com"


Expand All @@ -38,7 +38,7 @@ def get_cookies_all():

def get_cookies_by_domain(domain: str):
"""从所有cookie里分离出指定域名的cookie
domain: cookie_list domain, (".tsdm39.net")
domain: cookie_list domain, (".tsdm39.com")
"""
cookies_all = get_cookies_all() # { username: [cookie_list] }
domain_cookies = {}
Expand Down Expand Up @@ -69,10 +69,10 @@ def work_single_post(cookie: List):
# 必须要这个content-type, 否则没法接收
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko',
'cookie_list': cookie_serialized,
'cookie': cookie_serialized,
'connection': 'Keep-Alive',
'x-requested-with': 'XMLHttpRequest',
'referer': 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work',
'referer': 'https://www.tsdm39.com/plugin.php?id=np_cliworkdz:work',
'content-type': 'application/x-www-form-urlencoded'
}

Expand Down Expand Up @@ -131,6 +131,5 @@ def work_multi_post():
print("POST方式: 全部打工完成")
return


def main_handler(event, context):
work_multi_post()
work_multi_post()