30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""直接基于已有的网摘TXT重新生成图片,验证字体修复"""
|
|
|
|
import sys
|
|
import os
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'scripts'))
|
|
from datetime import datetime
|
|
from modules.image_generator import create_combined_webzine_image
|
|
|
|
# 读取已有的网摘TXT
|
|
txt_path = "output/military_webzine_20260512.txt"
|
|
with open(txt_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 提取3篇网摘文本(去掉顶部标题,按"="分割)
|
|
sections = content.split('==============================================================')
|
|
webzine_texts = []
|
|
for i in range(1, len(sections), 2):
|
|
if i+1 < len(sections):
|
|
webzine = sections[i+1].split('\n🔗 原文链接')[0].strip()
|
|
webzine_texts.append(webzine)
|
|
|
|
now = datetime.strptime('2026-05-12', '%Y-%m-%d')
|
|
output_path = "output/military_webzine_20260512_fixed.png"
|
|
|
|
# 重新生成图片
|
|
create_combined_webzine_image(webzine_texts, output_path, now)
|
|
print(f"修复后的图片已生成: {output_path}")
|