调整色花堂PDF格式
This commit is contained in:
@@ -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"标题:<br /> {post_title}", title_style))
|
||||
content.append(Spacer(1, 12))
|
||||
content.append(Paragraph(f"来源URL:<br /> {post_page_url}<br />", normal_style))
|
||||
content.append(Paragraph(f" {post_title}", title_style))
|
||||
content.append(Spacer(1, 12))
|
||||
# content.append(Paragraph(f"来源URL:<br /> {post_page_url}<br />", 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}】:<br />{value}<br />", normal_style))
|
||||
intro_content.append(Spacer(1, 6)) # 字段间距
|
||||
|
||||
# 添加格式化的介绍部分
|
||||
content.append(Paragraph("介绍:<br />", 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}】:<br />{value}<br />", normal_style))
|
||||
# intro_content.append(Spacer(1, 6)) # 字段间距
|
||||
#
|
||||
# # 添加格式化的介绍部分
|
||||
# content.append(Paragraph("介绍:<br />", normal_style))
|
||||
# content.extend(intro_content)
|
||||
# content.append(Spacer(1, 12))
|
||||
|
||||
# 添加磁力链接
|
||||
if magnet_links:
|
||||
for magnet_link in magnet_links:
|
||||
content.append(Paragraph(f"磁力链接:<br /><br /><b>{magnet_link}</b><br /><br />", normal_style))
|
||||
content.append(Paragraph(f"<br /><br /><b>{magnet_link}</b><br /><br />", normal_style))
|
||||
content.append(Spacer(1, 12))
|
||||
|
||||
# 添加图片
|
||||
|
||||
Reference in New Issue
Block a user