diff --git a/pt_site/UtilityTool.py b/pt_site/UtilityTool.py index 99b4156..764f84c 100644 --- a/pt_site/UtilityTool.py +++ b/pt_site/UtilityTool.py @@ -1,12 +1,12 @@ import logging import re import threading +import time from datetime import datetime import aip import cloudscraper import opencc -import time from django.db import transaction from django.db.models import QuerySet from lxml import etree @@ -465,7 +465,7 @@ class PtSpider: signin_today.save() return CommonResponse.success(msg=message) except Exception as e: - raise + # raise return CommonResponse.error(msg='签到失败!' + str(e)) @staticmethod @@ -800,10 +800,10 @@ class PtSpider: if not my_site.time_join and time_join: my_site.time_join = time_join + # 去除字符串中的中文 my_level_1 = ''.join( details_html.xpath(site.my_level_rule) - ).replace(' ', '').replace('(', '').replace(')', '').replace('_Name', '').strip() - # 去除字符串中的中文 + ).replace('_Name', '').strip() if 'city' in site.url: my_level = my_level_1.strip() else: @@ -815,10 +815,13 @@ class PtSpider: ).split('(')[0].strip('\xa0').strip() latest_active = latest_active_1.replace('(', '').replace(')', '').strip() + # my_sp = ''.join( + # details_html.xpath(site.my_sp_rule) + # ).replace(' ', '').replace('(', '').replace(')', '').replace(',', '').strip(']:').strip() + # 获取字符串中的魔力值 my_sp = ''.join( details_html.xpath(site.my_sp_rule) - ).replace(' ', '').replace('(', '').replace(')', '').replace(',', '').strip(']:').strip() - # 获取字符串中的魔力值 + ) print('魔力:', details_html.xpath(site.my_sp_rule)) if my_sp: diff --git a/pt_site/views.py b/pt_site/views.py index 9b8874d..3b3f267 100644 --- a/pt_site/views.py +++ b/pt_site/views.py @@ -55,14 +55,15 @@ try: res = pt_spider.parse_status_html(my_site, result.data) print('自动更新个人数据', my_site.site, res) if res.code == StatusCodeEnum.OK.code: + status = res.data[0] message = message_template.format( my_site.my_level, - res.data[0].my_sp, + status.my_sp, my_site.sp_hour, - res.data[0].my_bonus, - res.data[0].ratio, - res.data[0].downloaded, - res.data[0].uploaded, + status.my_bonus, + status.ratio, + status.downloaded, + status.uploaded, my_site.seed, my_site.leech, my_site.invitation,