From c8e4308821ee51a0962b9c3024a870334e36c4f2 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Sat, 27 Aug 2022 16:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=93=E5=AD=98=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/cms.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/classes/cms.py b/classes/cms.py index fe6e683..dc47535 100644 --- a/classes/cms.py +++ b/classes/cms.py @@ -202,8 +202,9 @@ class CMS: cache_classes = self.getClasses() if len(cache_classes) > 0: classes = cache_classes + # print(cache_classes) has_cache = True - + new_classes = [] r = requests.get(self.homeUrl, headers=self.headers, timeout=self.timeout) r.encoding = self.encoding html = r.text @@ -220,11 +221,13 @@ class CMS: tag = url if len(p) > 3 and p[3].strip(): tag = self.regexp(p[3].strip(),url,0) - classes.append({ + new_classes.append({ 'type_name': title, 'type_id': tag }) - self.saveClass(classes) + if len(new_classes) > 0: + classes.extend(new_classes) + self.saveClass(classes) video_result = self.homeVideoContent(html,fypage) except Exception as e: print(e) -- GitLab