mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
新增 zhuque自动释放技能
This commit is contained in:
@@ -866,6 +866,44 @@ class PtSpider:
|
||||
msg='{} 签到失败: {}'.format(site.name, e)
|
||||
)
|
||||
|
||||
def sign_in_zhuque(self, my_site):
|
||||
site = my_site.site
|
||||
try:
|
||||
csrf_res = self.send_request(my_site=my_site, url=site.url)
|
||||
# '<meta name="x-csrf-token" content="4db531b6687b6e7f216b491c06937113">'
|
||||
x_csrf_token = self.parse(site, csrf_res, '//meta[@name="x-csrf-token"]/@content')
|
||||
logger.info(f'csrf token: {x_csrf_token}')
|
||||
header = {
|
||||
'user-agent': my_site.user_agent,
|
||||
'content-type': 'application/json',
|
||||
'referer': 'https://zhuque.in/gaming/genshin/character/list',
|
||||
'x-csrf-token': ''.join(x_csrf_token),
|
||||
}
|
||||
data = {"resetModal": "true", "all": 1, }
|
||||
url = f'{site.url}{site.page_sign_in}'
|
||||
logger.info(url)
|
||||
res = self.send_request(my_site=my_site, method='post', url=url, json=data, header=header)
|
||||
# 单独发送请求,解决冬樱签到问题
|
||||
# res = requests.post(url=url, verify=False, cookies=cookie2dict(my_site.cookie), json=data, headers=header)
|
||||
"""
|
||||
{
|
||||
"status": 200,
|
||||
"data": {
|
||||
"code": "FIRE_GENSHIN_CHARACTER_MAGIC_SUCCESS",
|
||||
"bonus": 0
|
||||
}
|
||||
}
|
||||
"""
|
||||
logger.info(res.content)
|
||||
return CommonResponse.success(data=res.json())
|
||||
except Exception as e:
|
||||
# 打印异常详细信息
|
||||
logger.error(traceback.format_exc(limit=3))
|
||||
return CommonResponse.success(
|
||||
status=StatusCodeEnum.WEB_CONNECT_ERR,
|
||||
msg='{} 签到失败: {}'.format(site.name, e)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_user_torrent(html, rule):
|
||||
res_list = html.xpath(rule)
|
||||
@@ -939,6 +977,18 @@ class PtSpider:
|
||||
signin_today.sign_in_info = result.msg
|
||||
signin_today.save()
|
||||
return result
|
||||
if 'zhuque.in' in site.url:
|
||||
result = self.sign_in_zhuque(my_site)
|
||||
if result.code == StatusCodeEnum.OK.code and result.data.get('status') == 200:
|
||||
data = result.data.get("data")
|
||||
bonus = data.get("bonus")
|
||||
message = f'技能释放成功,获得{bonus}灵石'
|
||||
if bonus > 0:
|
||||
signin_today.sign_in_today = True
|
||||
signin_today.sign_in_info = message
|
||||
signin_today.save()
|
||||
result.msg = message
|
||||
return result
|
||||
if 'hdupt.com' in site.url:
|
||||
result = self.sign_in_hdupt(my_site)
|
||||
if result.code == StatusCodeEnum.OK.code:
|
||||
|
||||
@@ -7312,16 +7312,16 @@
|
||||
{
|
||||
"id": 99,
|
||||
"created_at": "2022-12-26 19:45:08.010450",
|
||||
"updated_at": "2023-02-21 15:54:44.269415",
|
||||
"updated_at": "2023-03-09 10:29:02.398415",
|
||||
"name": "朱雀",
|
||||
"url": "https://zhuque.in/",
|
||||
"logo": "https://gitee.com/ngfchl/ptools/raw/master/static/logo/zhuque.png",
|
||||
"sign_in_support": 0,
|
||||
"sign_in_support": 1,
|
||||
"get_torrent_support": 1,
|
||||
"get_userinfo_support": 1,
|
||||
"search_support": 0,
|
||||
"page_default": "torrents.php",
|
||||
"page_sign_in": "attendance.php",
|
||||
"page_sign_in": "api/gaming/fireGenshinCharacterMagic",
|
||||
"page_detail": "details.php?id={}",
|
||||
"page_download": "download.php?id={}",
|
||||
"page_user": "api/user/getInfo?id={}",
|
||||
@@ -7333,7 +7333,7 @@
|
||||
"page_mybonus": "api/user/getBonusCalc",
|
||||
"page_viewfilelist": "viewfilelist.php?id={}",
|
||||
"page_viewpeerlist": "viewpeerlist.php?id={}",
|
||||
"sign_in_method": "get",
|
||||
"sign_in_method": "post",
|
||||
"sign_in_captcha": 0,
|
||||
"sign_in_params": "{}",
|
||||
"sign_in_headers": "{}",
|
||||
|
||||
Reference in New Issue
Block a user