修复学校签到

This commit is contained in:
ngfchl
2022-11-20 23:27:55 +08:00
parent f35719d39b
commit b7e78cdd81
3 changed files with 17 additions and 22 deletions

View File

@@ -4823,7 +4823,7 @@
"pk": 70,
"fields": {
"created_at": "2022-07-17T10:24:59.754",
"updated_at": "2022-11-17T20:05:49.511",
"updated_at": "2022-11-20T23:20:45.336",
"url": "https://pt.btschool.club/",
"name": "BT学校",
"logo": "https://pt.btschool.club/favicon.ico",
@@ -4833,7 +4833,7 @@
"get_userinfo_support": true,
"search_support": false,
"page_default": "torrents.php",
"page_sign_in": "attendance.php",
"page_sign_in": "index.php?action=addbonus",
"page_control_panel": "usercp.php",
"page_detail": "details.php?id={}",
"page_download": "download.php?id={}",

View File

@@ -1099,26 +1099,22 @@ class PtSpider:
if 'btschool' in site.url:
logger.info(res.status_code)
logger.info(res.content.decode('utf-8'))
text = self.parse(res, '//a[@href="index.php"]/font/text()')
signin_stat = self.parse(res, '//a[contains(@href,"addbouns")]')
logger.info('{}:{}'.format(site.name, text))
if len(signin_stat) <= 0:
message = ''.join(text) if len(text) > 0 else '签到成功!'
signin_today.sign_in_today = True
signin_today.sign_in_info = message
signin_today.save()
return CommonResponse.success(msg=message)
"""
# text = self.parse(res, '//script/text()')
text = self.parse(res, '//script/text()')
if len(text) > 0:
location = self.parse_school_location(text)
logger.info('学校签到链接:' + location)
if 'addbouns.php' in location:
self.send_request(my_site=my_site, url=site.url + location.lstrip('/'), delay=60)
signin_today.sign_in_today = True
signin_today.sign_in_info = '签到成功!'
signin_today.save()
return CommonResponse.success(msg='签到成功!')
res_sign = self.send_request(my_site=my_site, url=site.url + location.lstrip('/'), delay=60)
sign_in_text = self.parse(res_sign, '//a[@href="index.php"]/font//text()')
sign_in_stat = self.parse(res_sign, '//a[contains(@href,"addbouns")]')
logger.info('{}:{}'.format(site.name, text))
if len(sign_in_stat) <= 0:
message = ''.join(sign_in_text)
signin_today.sign_in_today = True
signin_today.sign_in_info = message
signin_today.save()
return CommonResponse.success(msg=message)
return CommonResponse.error(msg='签到失败!')
else:
signin_today.sign_in_today = True
signin_today.sign_in_info = '签到成功!'
@@ -1132,8 +1128,7 @@ class PtSpider:
signin_today.save()
return CommonResponse.success(msg='签到成功!')
else:
"""
return CommonResponse.error(msg='签到失败或网络错误!')
return CommonResponse.error(msg='签到失败或网络错误!')
if res.status_code == 200:
status = converter.convert(res.content.decode('utf8'))
logger.info(status)

View File

@@ -4638,7 +4638,7 @@
{
"id": 70,
"created_at": "2022-07-17 10:24:59.754000",
"updated_at": "2022-11-17 20:05:49.511894",
"updated_at": "2022-11-20 23:20:45.336759",
"name": "BT学校",
"url": "https://pt.btschool.club/",
"logo": "https://pt.btschool.club/favicon.ico",
@@ -4647,7 +4647,7 @@
"get_userinfo_support": 1,
"search_support": 0,
"page_default": "torrents.php",
"page_sign_in": "attendance.php",
"page_sign_in": "index.php?action=addbonus",
"page_detail": "details.php?id={}",
"page_download": "download.php?id={}",
"page_user": "userdetails.php?id={}",