From e8696faeb8339241b2e96f79c946708c61aa7289 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 3 Mar 2025 15:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=89=B2=E8=8A=B1=E5=A0=82PD?= =?UTF-8?q?F=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sehuatang/shehuatang.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sehuatang/shehuatang.py b/sehuatang/shehuatang.py index 49a63bf..82d5415 100644 --- a/sehuatang/shehuatang.py +++ b/sehuatang/shehuatang.py @@ -129,31 +129,31 @@ def fetch_and_create_pdf(url): magnet_links = re.findall(r'magnet:\?[^ \u4e00-\u9fff]+', post_text) # 添加标题和来源URL - content.append(Paragraph(f"标题:
{post_title}", title_style)) - content.append(Spacer(1, 12)) - content.append(Paragraph(f"来源URL:
{post_page_url}
", normal_style)) + content.append(Paragraph(f" {post_title}", title_style)) content.append(Spacer(1, 12)) + # content.append(Paragraph(f"来源URL:
{post_page_url}
", normal_style)) + # content.append(Spacer(1, 12)) # 解析并格式化 "介绍" 内容 - intro_content = [] - intro_lines = post_text.split("【") # 以【分割字段 - for line in intro_lines: - if line.strip(): - line = "【" + line if not line.startswith("【") else line - if "】:" in line: - key, value = line.split("】:", 1) - intro_content.append(Paragraph(f"{key}】:
{value}
", normal_style)) - intro_content.append(Spacer(1, 6)) # 字段间距 - - # 添加格式化的介绍部分 - content.append(Paragraph("介绍:
", normal_style)) - content.extend(intro_content) - content.append(Spacer(1, 12)) + # intro_content = [] + # intro_lines = post_text.split("【") # 以【分割字段 + # for line in intro_lines: + # if line.strip(): + # line = "【" + line if not line.startswith("【") else line + # if "】:" in line: + # key, value = line.split("】:", 1) + # intro_content.append(Paragraph(f"{key}】:
{value}
", normal_style)) + # intro_content.append(Spacer(1, 6)) # 字段间距 + # + # # 添加格式化的介绍部分 + # content.append(Paragraph("介绍:
", normal_style)) + # content.extend(intro_content) + # content.append(Spacer(1, 12)) # 添加磁力链接 if magnet_links: for magnet_link in magnet_links: - content.append(Paragraph(f"磁力链接:

{magnet_link}

", normal_style)) + content.append(Paragraph(f"

{magnet_link}

", normal_style)) content.append(Spacer(1, 12)) # 添加图片