From eaa419878c542dc4ed6141817df4651d2275d320 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 17 Feb 2025 17:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A0=E6=95=88=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sehuatang/shehuatang.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sehuatang/shehuatang.py b/sehuatang/shehuatang.py index 41a8304..a470606 100644 --- a/sehuatang/shehuatang.py +++ b/sehuatang/shehuatang.py @@ -123,24 +123,24 @@ def fetch_and_create_pdf(url): if content_div: # 提取文本并将
标签替换为换行符 - post_text = content_div.get_text(separator='\n', strip=True) # 使用 separator='\n' 参数替换
标签 + post_text = content_div.get_text(strip=True) # 使用 separator='\n' 参数替换
标签 # 查找磁力链接 - magnet_links = re.findall(r'magnet:\?[^ ]+', post_text) # 使用正则表达式查找磁力链接 + magnet_links =re.findall(r'magnet:\?[^ \u4e00-\u9fff]+', post_text) # 使用正则表达式查找磁力链接 # 添加标题到PDF - content.append(Paragraph(f"标题:\n {post_title}", title_style)) + content.append(Paragraph(f"标题:
{post_title}", title_style)) content.append(Spacer(1, 12)) - content.append(Paragraph(f"来源URL:\n {post_page_url}\n", normal_style)) + content.append(Paragraph(f"来源URL:
{post_page_url}
", normal_style)) content.append(Spacer(1, 12)) - content.append(Paragraph(f"介绍:\n {post_text}\n", normal_style)) + content.append(Paragraph(f"介绍:
{post_text}
", normal_style)) content.append(Spacer(1, 12)) # 添加空白区域 # 如果有磁力链接,将其单独加粗并显示 if magnet_links: for magnet_link in magnet_links: # 将磁力链接作为加粗的内容显示 - content.append(Paragraph(f"Magnet Link:\n {magnet_link}\n\n", normal_style)) + content.append(Paragraph(f"Magnet Link:

{magnet_link}

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