From d9131b5cce2dfc89b120fba8dd6168015f4b1d36 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Fri, 14 Oct 2022 22:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=8D=E8=B4=B9=E7=A7=8D?= =?UTF-8?q?=E5=AD=90=E6=8A=93=E5=8F=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/UtilityTool.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pt_site/UtilityTool.py b/pt_site/UtilityTool.py index 3068fe9..06ae45f 100644 --- a/pt_site/UtilityTool.py +++ b/pt_site/UtilityTool.py @@ -1005,6 +1005,8 @@ class PtSpider: count = 0 new_count = 0 site = my_site.site + if not my_site.passkey: + return CommonResponse.error(msg='{}站点未设置Passkey,无法拼接种子链接!'.format(site.name)) # logger.info(response.text.encode('utf8')) try: with lock: @@ -1076,21 +1078,21 @@ class PtSpider: # # 下载链接,下载链接已存在则跳过 href = ''.join(tr.xpath(site.magnet_url_rule)) logger.info('href: {}'.format(href)) - magnet_url = site.url + href.replace('&type=zip', '').replace(site.url, '').lstrip('/') + magnet_url = '{}{}'.format( + site.url, + href.replace('&type=zip', '').replace(site.url, '').lstrip('/') + ) + logger.info('magnet_url: {}'.format(magnet_url)) if href.count('passkey') <= 0 and href.count('&sign=') <= 0: - download_url = magnet_url + '&passkey=' + my_site.passkey + download_url = '{}&passkey={}'.format(magnet_url, my_site.passkey) else: download_url = magnet_url logger.info('download_url: {}'.format(download_url)) - logger.info('magnet_url: {}'.format(magnet_url)) - - # if sale_status == '2X': - # sale_status = '2XFree' # 如果种子有HR,则为否 HR绿色表示无需,红色表示未通过HR考核 hr = False if tr.xpath(site.hr_rule) else True # H&R 种子有HR且站点设置不下载HR种子,跳过, - if not hr and not site.hr: + if not hr and not my_site.hr: logger.info('hr种子,未开启HR跳过') continue # # 促销到期时间