清除获取的分享率中的异常字符

This commit is contained in:
ngfchl
2022-12-13 11:12:39 +08:00
parent 36df8dfbd4
commit ca23ede2cc

View File

@@ -1771,12 +1771,12 @@ class PtSpider:
if not ratio:
ratio = ''.join(
details_html.xpath('//font[@class="color_ratio"][1]/following-sibling::font[1]/text()[1]'))
if ratio.count('上传量') > 0:
if ratio.count('上传量') > 0 and site.url == 'https://totheglory.im/':
# 适配TTG inf分享率
ratio = ''.join(
details_html.xpath(
'//font[contains(text(),"分享率 ")][1]/following-sibling::text()[1]')) \
.replace('\xa0', '').strip()
.replace('\xa0', '').replace('.', '').strip()
# 分享率告警通知
logger.info('ratio{}'.format(ratio))
if ratio and ratio != 'inf' and float(ratio) <= 1: