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)) # 添加空白区域
# 添加图片