From 81dd32ec97439989eb86f4ab33b64c027f3e2015 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Fri, 10 Mar 2023 00:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=E9=97=B4=E9=94=99=E8=AF=AF=E6=97=B6?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=EF=BC=8C=E4=B8=8D=E5=BD=B1=E5=93=8D=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BF=A1=E6=81=AF=E7=9A=84=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/UtilityTool.py | 72 ++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/pt_site/UtilityTool.py b/pt_site/UtilityTool.py index 930e81b..fb97bd1 100644 --- a/pt_site/UtilityTool.py +++ b/pt_site/UtilityTool.py @@ -2107,40 +2107,44 @@ class PtSpider: # logger.info('注册时间:', time_join_1) # time_join = time_join_1.replace('(', '').replace(')', '').strip('\xa0').strip() logger.info(f'注册时间:{details_html.xpath(site.time_join_rule)}') - if site.url in [ - 'https://monikadesign.uk/', - 'https://pt.hdpost.top/', - 'https://reelflix.xyz/', - ]: - time_str = ''.join(details_html.xpath(site.time_join_rule)) - time_str = re.sub(u"[\u4e00-\u9fa5]", "", time_str).strip() - time_join = datetime.strptime(time_str, '%b %d %Y') - logger.info(f'注册时间:{time_join}') - my_site.time_join = time_join - elif 'hd-torrents.org' in site.url: - time_join = datetime.strptime(''.join(details_html.xpath(site.time_join_rule)), '%d/%m/%Y %H:%M:%S') - my_site.time_join = time_join - elif site.url in [ - 'https://piggo.me/', - ]: - time_str = ''.join(details_html.xpath(site.time_join_rule)) - time_str = time_str.split('(')[0] - print(time_str) - time_join = datetime.strptime(time_str.strip(), '%Y-%m-%d %H:%M:%S') - my_site.time_join = time_join - elif site.url in [ - 'https://exoticaz.to/', - 'https://cinemaz.to/', - 'https://avistaz.to/', - ]: - time_str = ''.join(details_html.xpath(site.time_join_rule)).split('(')[0].strip() - time_join = datetime.strptime(time_str, '%d %b %Y %I:%M %p') - my_site.time_join = time_join - else: - time_join = re.findall(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}', ''.join( - details_html.xpath(site.time_join_rule) - ).strip()) - my_site.time_join = ''.join(time_join) + try: + if site.url in [ + 'https://monikadesign.uk/', + 'https://pt.hdpost.top/', + 'https://reelflix.xyz/', + ]: + time_str = ''.join(details_html.xpath(site.time_join_rule)) + time_str = re.sub(u"[\u4e00-\u9fa5]", "", time_str).strip() + time_join = datetime.strptime(time_str, '%b %d %Y') + logger.info(f'注册时间:{time_join}') + my_site.time_join = time_join + elif 'hd-torrents.org' in site.url: + time_join = datetime.strptime(''.join(details_html.xpath(site.time_join_rule)), + '%d/%m/%Y %H:%M:%S') + my_site.time_join = time_join + elif site.url in [ + 'https://piggo.me/', + ]: + time_str = ''.join(details_html.xpath(site.time_join_rule)) + time_str = time_str.split('(')[0] + print(time_str) + time_join = datetime.strptime(time_str.strip(), '%Y-%m-%d %H:%M:%S') + my_site.time_join = time_join + elif site.url in [ + 'https://exoticaz.to/', + 'https://cinemaz.to/', + 'https://avistaz.to/', + ]: + time_str = ''.join(details_html.xpath(site.time_join_rule)).split('(')[0].strip() + time_join = datetime.strptime(time_str, '%d %b %Y %I:%M %p') + my_site.time_join = time_join + else: + time_join = re.findall(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}', ''.join( + details_html.xpath(site.time_join_rule) + ).strip()) + my_site.time_join = ''.join(time_join) + except Exception as e: + self.send_text(title='ptools提醒', message=f'{site.name} 注册时间解析错误!') # 去除字符串中的中文 my_level_1 = ''.join( details_html.xpath(site.my_level_rule)