This commit is contained in:
MasonLiu committed 2025-01-10 10:02:43 +08:00
1 parent 865c477066
commit ad0403554e
24 files changed
+756 -1878

No files matched your search

+8 -12
View File
@@ -103,9 +103,8 @@ def insert_data():
"language": item.get("language", "")
}
try:
# 解析 pubDate 字符串为 datetime 对象
pub_date = datetime.strptime(entry['pubDate'], '%Y-%m-%dT%H:%M:%SZ')
# 格式化 pubDate 为所需的格式
pub_date += timedelta(hours=8)
formatted_pub_date = pub_date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
# 如果解析失败,使用原始 pubDate 字符串
@@ -128,7 +127,7 @@ def insert_data():
entry = {
"id": index,
"title": item.get("name", ""),
"link": item.get("link", ""),
"link": f"https://github.com/{item.get('keyword', '')}",
"description": item.get("description", ""),
"pubDate": item.get("updated_at", ""),
"author": item.get("author", ""),
@@ -136,9 +135,8 @@ def insert_data():
"link2": item.get("link_2", "")
}
try:
# 解析 pubDate 字符串为 datetime 对象
pub_date = datetime.strptime(entry['pubDate'], '%Y-%m-%dT%H:%M:%SZ')
# 格式化 pubDate 为所需的格式
pub_date += timedelta(hours=8)
formatted_pub_date = pub_date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
# 如果解析失败,使用原始 pubDate 字符串
@@ -158,9 +156,8 @@ def insert_data():
"keyword": item.get("keyword", "")
}
try:
# 解析 pubDate 字符串为 datetime 对象
pub_date = datetime.strptime(entry['pubDate'], '%Y-%m-%dT%H:%M:%SZ')
# 格式化 pubDate 为所需的格式
pub_date += timedelta(hours=8)
formatted_pub_date = pub_date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
# 如果解析失败,使用原始 pubDate 字符串
@@ -185,9 +182,8 @@ def insert_data():
"language": item.get("language", "")
}
try:
# 解析 pubDate 字符串为 datetime 对象
pub_date = datetime.strptime(entry['pubDate'], '%Y-%m-%dT%H:%M:%SZ')
# 格式化 pubDate 为所需的格式
pub_date += timedelta(hours=8)
formatted_pub_date = pub_date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
# 如果解析失败,使用原始 pubDate 字符串
@@ -316,7 +312,7 @@ def get_filtered_articles(entries, Is_short, choice):
result += f"项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
result += f"更新描述:{entry[3]}\n"
result += f"更新时间:{entry[4]}\n"
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[2]})\n"
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[6]})\n"
result += "\n" + "-" * 10 + "\n" # 添加分隔线以便区分不同文章
elif choice == 3:
result += f"大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"
@@ -337,7 +333,7 @@ def get_filtered_articles(entries, Is_short, choice):
result += f"项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
result += f"更新描述:{entry[3]}\n"
result += f"更新时间:{entry[4]}\n"
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[2]})\n"
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[6]})\n"
result += "\n" + "-" * 3 + "\n" # 添加分隔线以便区分不同文章
elif choice == 3:
result += f"大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"
@@ -359,7 +355,7 @@ def get_filtered_articles(entries, Is_short, choice):
record += f"#### 项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
record += f"**更新描述**:{entry[3]}\n"
record += f"**更新时间**:{entry[4]}\n"
record += f"**提交者**:{entry[5]},[点此查看提交详情]({entry[2]})\n"
record += f"**提交者**:{entry[5]},[点此查看提交详情]({entry[6]})\n"
record += "\n" + "-" * 10 + "\n" # 添加分隔线以便区分不同文章
elif choice == 3:
record += f"#### 大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"