feat: 实现微信公众号新闻和视频同步服务
- 使用 draft API 同步文章(适配个人订阅号) - 使用 material API 同步视频(含详情获取) - 自动建表(videos)、UPSERT 已有 articles 表 - 同步删除:微信端删除的素材自动从数据库移除 - APScheduler 定时调度,支持 --once 手动触发 - Docker + docker-compose 部署配置 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
config.py
Normal file
24
config.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
def _require(key: str) -> str:
|
||||
val = os.environ.get(key)
|
||||
if not val:
|
||||
raise SystemExit(f"Missing required env var: {key}")
|
||||
return val
|
||||
|
||||
|
||||
APP_ID = _require("app_id")
|
||||
APP_SECRET = _require("app_secret")
|
||||
DB_HOST = _require("db_host")
|
||||
DB_PORT = _require("db_port")
|
||||
DB_NAME = _require("db_name")
|
||||
DB_USER = _require("db_user")
|
||||
DB_PW = _require("db_pw")
|
||||
|
||||
DATABASE_URL = f"postgresql://{DB_USER}:{DB_PW}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
|
||||
|
||||
SYNC_INTERVAL_HOURS = int(os.environ.get("sync_interval_hours", "48"))
|
||||
Reference in New Issue
Block a user