格式微调

This commit is contained in:
liuwei
2025-02-17 16:54:33 +08:00
parent 16f6c82c09
commit 5208a08567

View File

@@ -129,18 +129,18 @@ def fetch_and_create_pdf(url):
magnet_links = re.findall(r'magnet:\?[^ ]+', post_text) # 使用正则表达式查找磁力链接
# 添加标题到PDF
content.append(Paragraph(f"标题: {post_title}", title_style))
content.append(Paragraph(f"标题:\n {post_title}", title_style))
content.append(Spacer(1, 12))
content.append(Paragraph(f"来源URL: {post_page_url}", normal_style))
content.append(Paragraph(f"来源URL:\n {post_page_url}\n", normal_style))
content.append(Spacer(1, 12))
content.append(Paragraph(f"介绍: {post_text}", normal_style))
content.append(Paragraph(f"介绍:\n {post_text}\n", normal_style))
content.append(Spacer(1, 12)) # 添加空白区域
# 如果有磁力链接,将其单独加粗并显示
if magnet_links:
for magnet_link in magnet_links:
# 将磁力链接作为加粗的内容显示
content.append(Paragraph(f"Magnet Link: <b>{magnet_link}</b>", normal_style))
content.append(Paragraph(f"Magnet Link:\n <b>{magnet_link}</b>\n\n", normal_style))
content.append(Spacer(1, 12)) # 添加空白区域
# 添加图片