更新修复了一个错误并优化了运行逻辑

This commit is contained in:
MasonLiu committed 2024-12-11 23:15:59 +08:00
1 parent f912c39598
commit 0620d56e9a
21 files changed
+163 -229

No files matched your search

+13 -3
View File
@@ -94,9 +94,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/sec_news.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
record = ""
+13 -2
View File
@@ -88,8 +88,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/sec_news.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
+13 -2
View File
@@ -95,8 +95,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/tech_passage.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
+13 -2
View File
@@ -94,8 +94,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/sec_news.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
+13 -2
View File
@@ -85,8 +85,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/tech_passage.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
+13 -2
View File
@@ -92,8 +92,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/sec_news.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""
+13 -2
View File
@@ -91,8 +91,19 @@ def clear_table():
conn.close()
def record_md(result, filename="./history/tech_passage.md"):
with open(filename, 'a', encoding='utf-8') as file:
file.write(result)
# 读取现有内容
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as file:
existing_content = file.read()
else:
existing_content = ""
# 将新内容插入到现有内容的开头
new_content = result + existing_content
# 写回文件
with open(filename, 'w', encoding='utf-8') as file:
file.write(new_content)
def get_filtered_articles(entries):
result = ""