Update app.py

This commit is contained in:
alantang 2025-04-11 14:19:40 +08:00 committed by GitHub
parent efdc5e168a
commit 1fac3ce2cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

9
app.py
View File

@ -159,10 +159,11 @@ def generate_txt_output(channels):
def save_file(content, filename):
"""通用文件保存函数"""
# 创建 live 文件夹,如果不存在
if not os.path.exists('live'):
os.makedirs('live')
live_folder = 'live'
if not os.path.exists(live_folder):
os.makedirs(live_folder)
file_path = os.path.join(live_folder, filename)
try:
file_path = os.path.join('live', filename)
with open(file_path, "w", encoding="utf-8") as f:
f.write(content)
print(f"✅ 成功生成 {file_path} 文件")
@ -206,4 +207,4 @@ def main():
if __name__ == "__main__":
main()
main()