提交 c8e43088 编写于 作者: H hjdhnx

优化缓存分类逻辑

上级 22e56b84
...@@ -202,8 +202,9 @@ class CMS: ...@@ -202,8 +202,9 @@ class CMS:
cache_classes = self.getClasses() cache_classes = self.getClasses()
if len(cache_classes) > 0: if len(cache_classes) > 0:
classes = cache_classes classes = cache_classes
# print(cache_classes)
has_cache = True has_cache = True
new_classes = []
r = requests.get(self.homeUrl, headers=self.headers, timeout=self.timeout) r = requests.get(self.homeUrl, headers=self.headers, timeout=self.timeout)
r.encoding = self.encoding r.encoding = self.encoding
html = r.text html = r.text
...@@ -220,11 +221,13 @@ class CMS: ...@@ -220,11 +221,13 @@ class CMS:
tag = url tag = url
if len(p) > 3 and p[3].strip(): if len(p) > 3 and p[3].strip():
tag = self.regexp(p[3].strip(),url,0) tag = self.regexp(p[3].strip(),url,0)
classes.append({ new_classes.append({
'type_name': title, 'type_name': title,
'type_id': tag 'type_id': tag
}) })
self.saveClass(classes) if len(new_classes) > 0:
classes.extend(new_classes)
self.saveClass(classes)
video_result = self.homeVideoContent(html,fypage) video_result = self.homeVideoContent(html,fypage)
except Exception as e: except Exception as e:
print(e) print(e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册