maazmdx/geopolitical-automation

GitHub: maazmdx/geopolitical-automation

一个基于 Python 和 GitHub Actions 的自动化流水线,用于抓取、过滤地缘政治新闻并生成 AI 驱动的结构化简报与社交媒体资产。

Stars: 0 | Forks: 0

# 地缘政治自动化流水线 一个面向生产环境的自动化流水线,用于监控快速变化的地缘政治与防务信号,将其重写为结构化的简报内容,并生成适合发布和归档的社交媒体资产。 其目标非常实用:减少人工监控时间,同时保持输出内容的事实性、可溯源性和可复现性。 ## 本仓库的功能 - 汇集地缘政治与航空航天/安全事件的 RSS 和网络来源 - 通过关键字和相关性过滤门筛选低信噪比内容 - 使用 AI 应急方案生成简洁的摘要和标题 - 生成带品牌标识的卡片和标题 - 可选将输出内容上传至 Google Drive - 跟踪已发布的链接,以减少多次运行时的重复内容 ## 技术栈 - **Python 3.11+** - **数据与抓取:** `feedparser`, `requests`, `trafilatura`, `beautifulsoup4`, `cloudscraper`, `yt-dlp` - **AI 提供商:** Groq, Gemini, OpenRouter, Hugging Face(视环境可选) - **图像渲染:** Pillow (`pillow-avif-plugin`) - **存储与集成:** Google Drive API - **自动化:** GitHub Actions (`.github/workflows/*.yml`) ## 项目布局 ``` . ├── main.py # Primary geopolitical automation pipeline ├── antigravity/ │ ├── main.py # Aerospace/advanced-physics automation variant │ └── generate_logos.py # Local logo asset generator ├── assets/ # Maps, flags, actor icons, backgrounds ├── fonts/ # Card typography assets ├── generate_assets.py # Map/actor visual asset generator ├── download_flags.py # Country flag downloader ├── generate_missing_flags.py # Fallback flag generator ├── oauth_setup.py # OAuth token bootstrap helper ├── exchange.py # OAuth code-to-token exchange helper ├── posted_links.json # Duplicate suppression tracker ├── ai_usage.json # AI usage tracker ├── requirements.txt └── .github/workflows/ # Scheduled + manual automation workflows ``` ## 本地设置 1. **创建并激活虚拟环境** python -m venv .venv source .venv/bin/activate 2. **安装依赖** pip install -r requirements.txt 3. **配置环境变量** cp .env.example .env # 然后使用实际值编辑 .env 将变量加载到你的 shell 中(示例): set -a source .env set +a ## 手动运行自动化 - **主流水线:** python main.py - **航空航天变体:** python antigravity/main.py 输出内容将生成在 `output/` 目录中(配置身份验证后可选择上传至 Drive)。 ## 定时自动化 工作流位于 `.github/workflows`: - `geopolitics.yml` — 每 30 分钟运行一次 + 手动触发 - `antigravity.yml` — 每 2 小时运行一次 + 手动触发 手动触发步骤: 1. 在 GitHub 上打开此仓库 2. 进入 **Actions** 3. 选择工作流 4. 点击 **Run workflow** ## 安全注意事项 - 仅将所有 API 密钥和身份验证 JSON 存放在环境变量或 secrets 中。 - 切勿提交 `.env`、原始 OAuth 代码、token JSON 或服务帐号密钥。 - 在执行 GitHub Actions 时,请使用仓库或组织级别的 secrets。
标签:GitHub Actions, IaC 扫描, Python, URL抓取, 内容生成, 数据抓取, 无后门, 自动化流水线, 自动笔记, 航空航天, 逆向工具