From b7e78cdd819f54fc39936a1ffeca2eeb7e64d702 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Sun, 20 Nov 2022 23:27:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=A6=E6=A0=A1=E7=AD=BE?= =?UTF-8?q?=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt.json | 4 ++-- pt_site/UtilityTool.py | 31 +++++++++++++------------------ pt_site_site.json | 4 ++-- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/pt.json b/pt.json index e108310..f3185fb 100644 --- a/pt.json +++ b/pt.json @@ -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={}", diff --git a/pt_site/UtilityTool.py b/pt_site/UtilityTool.py index cf02fdf..6c7632e 100644 --- a/pt_site/UtilityTool.py +++ b/pt_site/UtilityTool.py @@ -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) diff --git a/pt_site_site.json b/pt_site_site.json index a0c24c0..d072e74 100644 --- a/pt_site_site.json +++ b/pt_site_site.json @@ -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={}",