mirror of
https://github.com/rachelos/we-mp-rss.git
synced 2026-08-30 18:01:55 +08:00
"
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
1.py
|
||||
__pycache__
|
||||
*.xml
|
||||
config.yaml
|
||||
config.yaml
|
||||
*.pyc
|
||||
Vendored
+6
-4
@@ -9,16 +9,18 @@
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"env": {
|
||||
// "DB":"sqlite:///db.db",
|
||||
"DB":"sqlite:///db.db",
|
||||
// "DB":"mysql+pymysql://we-rss:123456@119.3.239.67/we-rss",
|
||||
"PORT": "8080",
|
||||
"USERNAME":"admin",
|
||||
"PASSWORD":"admin@123",
|
||||
"DEBUG": "True",
|
||||
// "DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=67933f7b759241a79c122f42d02a627f4457c0b40603ddf3b4711e88e859d072"
|
||||
"DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=af7f99c32895f79d9d61c57181f164b77027102a22f3b205dc15e2984690025c"
|
||||
// "DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=af7f99c32895f79d9d61c57181f164b77027102a22f3b205dc15e2984690025c"
|
||||
"DINGDING_WEBHOOK":"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a7240ff8-2d2e-48b3-b02a-c6a37fee69f7"
|
||||
},
|
||||
"program": "main.py",
|
||||
// "program": "job.py",
|
||||
// "program": "main.py",
|
||||
"program": "job.py",
|
||||
"args": ["-init", "True","-job","False"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -509,3 +509,67 @@
|
||||
2025-05-27 22:57:25 - core.log - INFO - 中国妇女报 更新结束,共更新0
|
||||
2025-05-27 22:57:26 - core.log - INFO - 长沙发布 更新结束,共更新0
|
||||
2025-05-27 22:57:26 - core.log - INFO - 所有公众号更新完成,共更新0条数据
|
||||
2025-05-28 11:41:33 - core.log - INFO - 扫描全能王 更新结束,共更新0
|
||||
2025-05-28 11:41:34 - core.log - INFO - 中关村论坛 更新结束,共更新0
|
||||
2025-05-28 11:41:35 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0
|
||||
2025-05-28 11:41:36 - core.log - INFO - 中国妇女报 更新结束,共更新3
|
||||
2025-05-28 11:41:37 - core.log - INFO - 长沙发布 更新结束,共更新4
|
||||
2025-05-28 11:41:37 - core.log - INFO - 所有公众号更新完成,共更新7条数据
|
||||
2025-05-28 11:42:11 - core.log - INFO - 扫描全能王 更新结束,共更新0
|
||||
2025-05-28 11:42:12 - core.log - INFO - 中关村论坛 更新结束,共更新0
|
||||
2025-05-28 11:42:13 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0
|
||||
2025-05-28 11:42:14 - core.log - INFO - 中国妇女报 更新结束,共更新0
|
||||
2025-05-28 11:42:14 - core.log - INFO - 长沙发布 更新结束,共更新0
|
||||
2025-05-28 11:42:14 - core.log - INFO - 所有公众号更新完成,共更新0条数据
|
||||
2025-05-28 12:32:36 - core.log - INFO - 扫描全能王 更新结束,共更新0
|
||||
2025-05-28 12:32:36 - core.log - INFO - 中关村论坛 更新结束,共更新0
|
||||
2025-05-28 12:32:36 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0
|
||||
2025-05-28 12:32:36 - core.log - INFO - 中国妇女报 更新结束,共更新0
|
||||
2025-05-28 12:32:36 - core.log - INFO - 长沙发布 更新结束,共更新0
|
||||
2025-05-28 12:32:36 - core.log - INFO - 所有公众号更新完成,共更新0条数据
|
||||
2025-05-28 12:33:27 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:33:28 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:33:29 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:33:30 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:33:31 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:33:31 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:48:25 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:48:27 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:48:28 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:48:29 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:50:10 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:50:11 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:50:12 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:50:13 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:50:14 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:50:14 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:53:07 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:53:08 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:53:09 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:53:10 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:53:11 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:53:11 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:53:48 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:53:49 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:53:50 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:53:52 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:53:53 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:53:53 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:54:15 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:54:16 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:54:18 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:54:19 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:54:20 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:54:20 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:55:49 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:55:50 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:55:51 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:55:52 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:55:53 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:55:53 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
2025-05-28 12:56:16 - core.log - INFO - 扫描全能王 更新结束,共更新10
|
||||
2025-05-28 12:56:17 - core.log - INFO - 中关村论坛 更新结束,共更新10
|
||||
2025-05-28 12:56:18 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10
|
||||
2025-05-28 12:56:19 - core.log - INFO - 中国妇女报 更新结束,共更新10
|
||||
2025-05-28 12:56:20 - core.log - INFO - 长沙发布 更新结束,共更新10
|
||||
2025-05-28 12:56:20 - core.log - INFO - 所有公众号更新完成,共更新50条数据
|
||||
|
||||
+4
-1
@@ -13,4 +13,7 @@ token:
|
||||
user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.39...
|
||||
|
||||
#定时任务执行间隔时间 单位秒 默认300s
|
||||
interval: ${INTERVAL:- 300}
|
||||
interval: ${INTERVAL:- 300}
|
||||
|
||||
#调试模式
|
||||
debug: ${DEBUG:-False}
|
||||
+1
-1
@@ -66,5 +66,5 @@ cfg=Config()
|
||||
config = cfg.get_config()
|
||||
DEBUG=cfg.get("debug",False)
|
||||
APP_NAME=cfg.get("app_name","we-mp-rss")
|
||||
from ver import VERSION
|
||||
from core.ver import VERSION
|
||||
print(VERSION)
|
||||
@@ -0,0 +1,28 @@
|
||||
from .wechat import send_wechat_message
|
||||
from .dingtalk import send_dingtalk_message
|
||||
|
||||
def notice( webhook_url, title, text,notice_type: str=None):
|
||||
"""
|
||||
公用通知方法,根据类型判断调用哪种通知
|
||||
|
||||
参数:
|
||||
- notice_type: 通知类型,'wechat' 或 'dingtalk'
|
||||
- webhook_url: 对应机器人的Webhook地址
|
||||
- title: 消息标题
|
||||
- text: 消息内容
|
||||
"""
|
||||
if 'qyapi.weixin.qq.com' in webhook_url:
|
||||
notice_type = 'wechat'
|
||||
elif 'oapi.dingtalk.com' in webhook_url:
|
||||
notice_type = 'dingtalk'
|
||||
else:
|
||||
print('无法根据 webhook_url 识别通知类型')
|
||||
return
|
||||
|
||||
if notice_type == 'wechat':
|
||||
|
||||
send_wechat_message(webhook_url, title, text)
|
||||
elif notice_type == 'dingtalk':
|
||||
send_dingtalk_message(webhook_url, title, text)
|
||||
else:
|
||||
print('不支持的通知类型')
|
||||
@@ -1,6 +1,6 @@
|
||||
import requests
|
||||
import json
|
||||
def send_dingtalk_markdown(webhook_url, title, text, is_at_all=False, at_mobiles=[]):
|
||||
def send_dingtalk_message(webhook_url, title, text, is_at_all=False, at_mobiles=[]):
|
||||
"""
|
||||
发送Markdown格式消息
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
def send_wechat_message(webhook_url, title, text):
|
||||
"""
|
||||
发送微信消息
|
||||
|
||||
参数:
|
||||
- webhook_url: 微信机器人Webhook地址
|
||||
- title: 消息标题
|
||||
- text: 消息内容
|
||||
"""
|
||||
# 截取 text 确保字符数不超过 4096 个
|
||||
text = text[:2048]
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
data = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"content": f"{text}"
|
||||
}
|
||||
}
|
||||
try:
|
||||
response = requests.post(
|
||||
url=webhook_url,
|
||||
headers=headers,
|
||||
data=json.dumps(data)
|
||||
)
|
||||
print(response.text)
|
||||
except Exception as e:
|
||||
print('微信通知发送失败', e)
|
||||
@@ -0,0 +1,3 @@
|
||||
# 通知调整
|
||||
- 增加微信通知
|
||||
- 优化通知机制
|
||||
@@ -2,7 +2,7 @@ import schedule, time
|
||||
import core.wx as wx
|
||||
import core.db as db
|
||||
from core.config import DEBUG,cfg
|
||||
import core.notice as notice
|
||||
|
||||
import random
|
||||
import core.log as log
|
||||
from datetime import datetime
|
||||
@@ -35,15 +35,15 @@ def do_job():
|
||||
faker_id=item.faker_id
|
||||
mp_id=item.id
|
||||
print(f'正在更新公众号:{item.mp_name}({item.id})')
|
||||
if not DEBUG:
|
||||
# 获取对应公众号列表
|
||||
data=wx.get_list(faker_id,mp_id,0)
|
||||
for art in data:
|
||||
# 添加到数据库
|
||||
# delete_article(art['id'])
|
||||
if wx_db.add_article(art):
|
||||
mps_count=mps_count+1
|
||||
text_list+=f"{mps_count}. [{art['title']}](https://mp.weixin.qq.com/s/{art['id']})[{art['created_at']}]\n"
|
||||
data=wx.get_list(faker_id,mp_id,0)
|
||||
for art in data:
|
||||
# 添加到数据库
|
||||
if DEBUG:
|
||||
delete_article(art['id'])
|
||||
if wx_db.add_article(art):
|
||||
mps_count=mps_count+1
|
||||
text_list+=f"{mps_count}. [{art['title']}](https://mp.weixin.qq.com/s/{art['id']})[{art['created_at']}]\n"
|
||||
else:
|
||||
print("调试模式,不进行更新")
|
||||
|
||||
@@ -68,11 +68,11 @@ def start():
|
||||
time.sleep(10)
|
||||
|
||||
def send_notice(text:str="",title:str=""):
|
||||
markdown_text = f"""### {title} 通知
|
||||
{text}
|
||||
"""
|
||||
webhook=cfg.get('notice')['dingding']
|
||||
notice.send_dingtalk_markdown(webhook, title, markdown_text)
|
||||
markdown_text = f"### {title} 通知\n{text}"
|
||||
webhook = cfg.get('notice')['dingding']
|
||||
# 修正参数顺序
|
||||
from core.notice import notice
|
||||
notice(webhook, title, markdown_text)
|
||||
|
||||
if __name__ == '__main__':
|
||||
do_job()
|
||||
File diff suppressed because one or more lines are too long
+21
-2
@@ -4,8 +4,27 @@ REM 读取Python配置文件中的版本号
|
||||
for /f "tokens=1 delims==" %%v in ('python -c "from core.ver import VERSION; print(VERSION)"') do set VERSION=%%v
|
||||
set tag="v%VERSION%"
|
||||
echo 当前版本: %VERSION% TAG: %tag%
|
||||
|
||||
set comment="%1"
|
||||
set version_file="docs/versions/%VERSION%"
|
||||
if exist %version_file% (
|
||||
setlocal enabledelayedexpansion
|
||||
set "comment=""
|
||||
for /f "usebackq delims=" %%a in (%version_file%) do (
|
||||
if defined comment (
|
||||
set "comment=!comment!\n%%a"
|
||||
) else (
|
||||
set "comment=%%a"
|
||||
)
|
||||
)
|
||||
endlocal & set "comment=%comment%"
|
||||
) else (
|
||||
echo 警告:未找到对应版本号的文件 %version_file%
|
||||
)
|
||||
echo %comment%
|
||||
pause
|
||||
git add .
|
||||
git tag "v%VERSION%" -m "%1"
|
||||
git commit -m %VERSION%
|
||||
git tag "v%VERSION%" -m "%comment%"
|
||||
git commit -m "%comment%"
|
||||
git push -u origin main
|
||||
git push origin %tag%
|
||||
Reference in New Issue
Block a user