From b52790038b187fe39ecf74f534d61dab5e1c68ab Mon Sep 17 00:00:00 2001 From: CMJNB <53365071+CMJNB@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:30:11 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9send=5Fmsg=E7=9A=84keyw?= =?UTF-8?q?ord=E5=88=B0=E5=87=BD=E6=95=B0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feapder/utils/tools.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/feapder/utils/tools.py b/feapder/utils/tools.py index a0ccbf13..733e1f77 100644 --- a/feapder/utils/tools.py +++ b/feapder/utils/tools.py @@ -2684,13 +2684,12 @@ def feishu_warning(message, message_prefix=None, rate_limit=None, url=None, user return False -def send_msg(msg, level="DEBUG", message_prefix=""): +def send_msg(msg, level="DEBUG", message_prefix="", keyword="feapder报警系统\n"): if setting.WARNING_LEVEL == "ERROR": if level.upper() != "ERROR": return if setting.DINGDING_WARNING_URL: - keyword = "feapder报警系统\n" dingding_warning(keyword + msg, message_prefix=message_prefix) if setting.EMAIL_RECEIVER: @@ -2700,11 +2699,9 @@ def send_msg(msg, level="DEBUG", message_prefix=""): email_warning(msg, message_prefix=message_prefix, title=title) if setting.WECHAT_WARNING_URL: - keyword = "feapder报警系统\n" wechat_warning(keyword + msg, message_prefix=message_prefix) if setting.FEISHU_WARNING_URL: - keyword = "feapder报警系统\n" feishu_warning(keyword + msg, message_prefix=message_prefix) From 80a104f16625b2d1ff63aef94edc814f82a59b71 Mon Sep 17 00:00:00 2001 From: CMJNB <53365071+CMJNB@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:30:48 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=96=B0=E5=A2=9EQmsg=E9=85=B1=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...46\345\217\212\347\233\221\346\216\247.md" | 14 +++++ feapder/setting.py | 4 ++ feapder/templates/project_template/setting.py | 4 ++ feapder/utils/tools.py | 52 +++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git "a/docs/source_code/\346\212\245\350\255\246\345\217\212\347\233\221\346\216\247.md" "b/docs/source_code/\346\212\245\350\255\246\345\217\212\347\233\221\346\216\247.md" index 5756a0dc..87dbc695 100644 --- "a/docs/source_code/\346\212\245\350\255\246\345\217\212\347\233\221\346\216\247.md" +++ "b/docs/source_code/\346\212\245\350\255\246\345\217\212\347\233\221\346\216\247.md" @@ -86,6 +86,20 @@ EMAIL_RECEIVER = "" # 收件人 支持列表,可指定多个 4. 将本邮箱账号添加到白名单中 +## Qmsg酱报警 + +Qmsg酱是一个QQ消息推送机器人,用来通知自己消息的免费服务。 + +可以参考文档:https://qmsg.zendee.cn/docs/api/ + +```python +# QMSG报警 +QMSG_WARNING_URL = "" # qmsg机器人api +QMSG_WARNING_QQ = "" # 指定要接收消息的QQ号或者QQ群。多个以英文逗号分割,例如:12345,12346,支持列表,可指定多人 +QMSG_WARNING_BOT = "" # 机器人的QQ号 +``` + + ## 报警间隔及报警级别 框架会对相同的报警进行过滤,防止刷屏,默认的报警时间间隔为1小时,可通过以下配置修改: diff --git a/feapder/setting.py b/feapder/setting.py index 93d9b896..1c366e8b 100644 --- a/feapder/setting.py +++ b/feapder/setting.py @@ -182,6 +182,10 @@ WECHAT_WARNING_URL = "" # 企业微信机器人api WECHAT_WARNING_PHONE = "" # 报警人 将会在群内@此人, 支持列表,可指定多人 WECHAT_WARNING_ALL = False # 是否提示所有人, 默认为False +# QMSG报警 +QMSG_WARNING_URL = "" # qmsg机器人api +QMSG_WARNING_QQ = "" # 指定要接收消息的QQ号或者QQ群。多个以英文逗号分割,例如:12345,12346,支持列表,可指定多人 +QMSG_WARNING_BOT = "" # 机器人的QQ号 # 时间间隔 WARNING_INTERVAL = 3600 # 相同报警的报警时间间隔,防止刷屏; 0表示不去重 WARNING_LEVEL = "DEBUG" # 报警级别, DEBUG / INFO / ERROR diff --git a/feapder/templates/project_template/setting.py b/feapder/templates/project_template/setting.py index 61097904..a80cbe1a 100644 --- a/feapder/templates/project_template/setting.py +++ b/feapder/templates/project_template/setting.py @@ -164,6 +164,10 @@ # WECHAT_WARNING_URL = "" # 企业微信机器人api # WECHAT_WARNING_PHONE = "" # 报警人 将会在群内@此人, 支持列表,可指定多人 # WECHAT_WARNING_ALL = False # 是否提示所有人, 默认为False +# # QMSG报警 +# QMSG_WARNING_URL = "" # qmsg机器人api +# QMSG_WARNING_QQ = "" # 指定要接收消息的QQ号或者QQ群。多个以英文逗号分割,例如:12345,12346,支持列表,可指定多人 +# QMSG_WARNING_BOT = "" # 机器人的QQ号 # # 时间间隔 # WARNING_INTERVAL = 3600 # 相同报警的报警时间间隔,防止刷屏; 0表示不去重 # WARNING_LEVEL = "DEBUG" # 报警级别, DEBUG / INFO / ERROR diff --git a/feapder/utils/tools.py b/feapder/utils/tools.py index 733e1f77..98d4c099 100644 --- a/feapder/utils/tools.py +++ b/feapder/utils/tools.py @@ -2684,6 +2684,55 @@ def feishu_warning(message, message_prefix=None, rate_limit=None, url=None, user return False +def qmsg_warning( + message, + message_prefix=None, + rate_limit=None, + url=None, + user_qq=None, + bot_qq=None +): + """qmsg报警""" + + # 为了加载最新的配置 + rate_limit = rate_limit if rate_limit is not None else setting.WARNING_INTERVAL + url = url or setting.QMSG_WARNING_URL + user_qq = user_qq or setting.QMSG_WARNING_QQ + bot_qq = bot_qq or setting.QMSG_WARNING_BOT + + if isinstance(user_qq, list): + user_qq = ','.join(map(str, user_qq)) + + if not all([url, message]): + return + + if reach_freq_limit(rate_limit, url, user_qq, message_prefix or message): + log.info("报警时间间隔过短,此次报警忽略。 内容 {}".format(message)) + return + + data = { + "msg": message, + "qq": user_qq, + "bot": bot_qq, + } + + headers = {"Content-Type": "application/json"} + + try: + response = requests.post( + url, headers=headers, data=json.dumps(data).encode("utf8") + ) + result = response.json() + response.close() + if result.get("code") == 0: + return True + else: + raise Exception(result.get("reason")) + except Exception as e: + log.error("报警发送失败。 报警内容 {}, error: {}".format(message, e)) + return False + + def send_msg(msg, level="DEBUG", message_prefix="", keyword="feapder报警系统\n"): if setting.WARNING_LEVEL == "ERROR": if level.upper() != "ERROR": @@ -2704,6 +2753,9 @@ def send_msg(msg, level="DEBUG", message_prefix="", keyword="feapder报警系统 if setting.FEISHU_WARNING_URL: feishu_warning(keyword + msg, message_prefix=message_prefix) + if setting.QMSG_WARNING_URL: + qmsg_warning(keyword + msg, message_prefix=message_prefix) + ################### From 15ab9d5f7206cabcd186944ac394a99ba2296524 Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 19 Dec 2025 18:51:32 +0800 Subject: [PATCH 03/10] . --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 4d5fa39a..a9617ba7 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,15 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, 1. start_requests: 生产任务 2. parse: 解析数据 + +## 感谢Tordata代理赞助 + + + + + + + ## 参与贡献 贡献之前请先阅读 [贡献指南](./CONTRIBUTING.md) From 4c64ff1a9283235e8ace8794ed5da9867fca8ae9 Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 19 Dec 2025 18:53:07 +0800 Subject: [PATCH 04/10] add Tordata ad --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9617ba7..cc886b13 100644 --- a/README.md +++ b/README.md @@ -110,9 +110,10 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, ## 感谢Tordata代理赞助 + - + From bd186691e25d768918a45116084130419a5fb892 Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 19 Dec 2025 18:54:39 +0800 Subject: [PATCH 05/10] add Thordata ad --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc886b13..67ca5d2d 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, 2. parse: 解析数据 -## 感谢Tordata代理赞助 +## 感谢Thordata代理赞助 From a0272c209af31df80bf9d383a2e597fc657d547a Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 3 Apr 2026 17:13:32 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B5=9E=E5=8A=A9?= =?UTF-8?q?=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 67ca5d2d..45e02009 100644 --- a/README.md +++ b/README.md @@ -108,12 +108,11 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, 2. parse: 解析数据 -## 感谢Thordata代理赞助 +## 感谢Rapidproxy代理赞助 + - - - + From 090e17b7a8476a9a04b2e0162785b2376c0b011b Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Thu, 16 Apr 2026 11:28:02 +0800 Subject: [PATCH 07/10] update readme --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 45e02009..bc157c96 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,11 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, 2. parse: 解析数据 -## 感谢Rapidproxy代理赞助 +## 感谢以下代理赞助商 + +### Rapidproxy代理 + + @@ -116,6 +120,17 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, +### SWIFTPROXY + + + + + + + + + + ## 参与贡献 贡献之前请先阅读 [贡献指南](./CONTRIBUTING.md) From 72d4eaaeb7e75e23a239fdd3fb7fd2d0d33557b5 Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 17 Apr 2026 09:37:32 +0800 Subject: [PATCH 08/10] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc157c96..c7713c34 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, - + From 33097cc45a46b45dba0ef5d36e00b794650c7309 Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 24 Apr 2026 17:51:00 +0800 Subject: [PATCH 09/10] . --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c7713c34..3ced6614 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,14 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, +### NovProxy + + + + + + + ## 参与贡献 From f8d6301aa9657b57756fa37f03f44617f293ea6f Mon Sep 17 00:00:00 2001 From: Boris <564773807@qq.com> Date: Fri, 24 Apr 2026 17:53:11 +0800 Subject: [PATCH 10/10] . --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3ced6614..7bde6250 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ FirstSpider|2021-02-09 14:55:14,620|air_spider.py|run|line:80|INFO| 无任务, ### NovProxy + +