From cc876f3dbe31f81a460841cbc35fa53043692657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E7=A5=9E?= <3162475700@qq.com> Date: Wed, 3 Jul 2024 23:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=9C=E4=BF=AE=E5=A4=8D=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E8=8E=B7=E5=8F=96=E6=B2=A1=E6=9C=89=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push_rss_update/send_email.py | 2 ++ rss_subscribe/last_articles.json | 8 -------- run.py | 17 +++++++++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/push_rss_update/send_email.py b/push_rss_update/send_email.py index 78a0ba5..264ddaa 100644 --- a/push_rss_update/send_email.py +++ b/push_rss_update/send_email.py @@ -61,6 +61,8 @@ def send_emails(emails, sender_email, smtp_server, port, password, subject, body use_tls (bool): 是否使用 TLS 加密,默认为 True。 """ for email in emails: + print(f'正在发送邮件到 {email}') + print(f'---------------------------\n邮件主题: {subject}\n邮件内容: {body}\n发件人: {sender_email}\n---------------------------') email_sender(email, sender_email, smtp_server, port, password, subject, body, use_tls) diff --git a/rss_subscribe/last_articles.json b/rss_subscribe/last_articles.json index e5ea8d0..91f5f93 100644 --- a/rss_subscribe/last_articles.json +++ b/rss_subscribe/last_articles.json @@ -1,13 +1,5 @@ { "articles": [ - { - "title": "东软软件园实习日记", - "author": "", - "link": "https://blog.qyliu.top/posts/13e6e155/", - "published": "2024-07-01 08:39", - "summary": "大学生累成狗,今天我终于理解了为什么这么说,好不容易结束了为期七天的实训课程,又要写实验报告加小组作业,好不容易完成了小组作业,这不,十五天实习又来了!烦!并且还要天天写学习日志?我直接当作日记写好不好!", - "content": "大学生累成狗,今天我终于理解了为什么这么说,好不容易结束了为期七天的实训课程,又要写实验报告加小组作业,好不容易完成了小组作业,这不,十五天实习又来了!烦!并且还要天天写学习日志?我直接当作日记写好不好!" - }, { "title": "Github Action实现友链状态检测", "author": "", diff --git a/run.py b/run.py index 0d3966d..ef914ca 100644 --- a/run.py +++ b/run.py @@ -37,13 +37,6 @@ if config["rss_subscribe"]["enable"]: github_username = config["rss_subscribe"]["github_username"] github_repo = config["rss_subscribe"]["github_repo"] your_blog_url = config["rss_subscribe"]["your_blog_url"] - github_api_url = "https://api.github.com/repos/" + github_username + "/" + github_repo + "/issues" + "?state=closed" - print("正在从 {github_api_url} 中获取订阅信息".format(github_api_url=github_api_url)) - email_list = extract_emails_from_issues(github_api_url) - if email_list == None: - print("无邮箱列表") - sys.exit() - print("获取到的邮箱列表为:", email_list) # 获取最近更新的文章 latest_articles = get_latest_articles_from_link( url=your_blog_url, @@ -54,10 +47,18 @@ if config["rss_subscribe"]["enable"]: if latest_articles == None: print("没有新文章") else: + github_api_url = "https://api.github.com/repos/" + github_username + "/" + github_repo + "/issues" + "?state=closed" + print("正在从 {github_api_url} 中获取订阅信息".format(github_api_url=github_api_url)) + email_list = extract_emails_from_issues(github_api_url) + if email_list == None: + print("无邮箱列表") + sys.exit(0) + else: + print("获取到的邮箱列表为:", email_list) # 循环latest_articles,发送邮件 for article in latest_articles: send_emails( - emails=email_list, + emails=email_list["emails"], sender_email=email, smtp_server=server, port=port,