Skip to content

badhope/Auto-SignIn

Repository files navigation

Auto-SignIn v2 🚀

现代化自动化签到工具 - 告别 GUI,拥抱 CLI + Docker + GitHub Actions

Python 3.8+ License: MIT Docker Pulls


✨ 特性亮点

  • 🎯 纯 CLI 界面 - 无需 GUI,服务器友好
  • 🐳 Docker 支持 - 一键部署,开箱即用
  • ☁️ GitHub Actions - 云端运行,免费 2000 分钟/月
  • 📊 数据库支持 - SQLite 存储签到历史
  • 🔔 多渠道通知 - 邮件/Telegram/Webhook
  • 🔧 配置灵活 - 环境变量 + YAML + .env 文件
  • 📈 统计分析 - 签到成功率、趋势分析
  • 🚀 易扩展 - 模块化设计,轻松添加新平台

🚀 快速开始

方式一:本地运行

# 1. 克隆项目
git clone https://github.com/yourusername/autosignin.git
cd autosignin

# 2. 安装依赖
pip install -r requirements.txt

# 3. 添加账号
python -m src.cli.main add netease -u "我的账号" -c "MUSIC_U=xxx; __csrf=xxx"

# 4. 执行签到
python -m src.cli.main signin --all

方式二:Docker 运行

# 1. 构建镜像
docker build -t autosignin:latest .

# 2. 运行容器
docker run -d \
  --name autosignin \
  -v $(pwd)/config:/app/config \
  -v $(pwd)/data:/app/data \
  -e NETEASE_COOKIES="MUSIC_U=xxx" \
  autosignin:latest

方式三:GitHub Actions

  1. Fork 本仓库
  2. 在 Settings → Secrets and variables → Actions 添加 Secrets:
    • NETEASE_COOKIES: 网易云音乐 Cookie
    • BILIBILI_COOKIES: B 站 Cookie
  3. Actions 会自动每天运行

📖 使用文档

🍪 Cookie 获取(重要!)

新手必读:签到需要 Cookie 认证,请按照以下步骤获取:

快速方法(3 分钟搞定)

  1. 打开网易云音乐并登录

  2. 按 F12 打开开发者工具

    • 切换到 Console(控制台)标签
  3. 复制粘贴以下代码并按回车

    console.log(document.cookie);
  4. 复制输出结果

    • 会显示类似:MUSIC_U=xxx; __csrf=xxx; NMTID=xxx
    • 完整复制整行内容
  5. 添加到命令行

    python -m src.cli.main add netease -u "我的账号" -c "复制的 Cookie"

详细教程

其他平台


CLI 命令

# 查看帮助
python -m src.cli.main --help

# 添加账号
python -m src.cli.main add netease -u "用户名" -c "Cookie 字符串"
python -m src.cli.main add bilibili -u "用户名" -c "Cookie 字符串"

# 执行签到
python -m src.cli.main signin              # 签到所有账号
python -m src.cli.main signin -p netease   # 签到指定平台

# 查看历史
python -m src.cli.main history             # 最近 10 条
python -m src.cli.main history -l 50       # 最近 50 条
python -m src.cli.main history -p netease  # 指定平台

# 查看统计
python -m src.cli.main stats               # 最近 7 天
python -m src.cli.main stats -d 30         # 最近 30 天

# 列出账号
python -m src.cli.main list
python -m src.cli.main list -p netease

# 删除账号
python -m src.cli.main remove netease -u "用户名"

# 定时任务
python -m src.cli.main schedule --enable   # 启用
python -m src.cli.main schedule --disable  # 禁用
python -m src.cli.main schedule -t "09:00" # 设置时间

# 配置管理
python -m src.cli.main config --show       # 显示配置
python -m src.cli.main config --init       # 初始化配置

环境变量

# .env 文件示例
AUTOSIGNIN_DEBUG=false
AUTOSIGNIN_SCHEDULE=true
AUTOSIGNIN_SCHEDULE_TIME=08:00
AUTOSIGNIN_NOTIFICATION=true

# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id

# 邮箱
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@gmail.com
SMTP_PASSWORD=your_password
TO_EMAIL=receive_email@gmail.com

📁 项目结构

autosignin/
├── src/
│   ├── core/              # 核心模块
│   │   ├── engine.py      # 签到引擎
│   │   ├── config.py      # 配置管理
│   │   ├── database.py    # 数据库
│   │   └── notifier.py    # 通知系统
│   ├── platforms/         # 平台签到
│   │   ├── base.py        # 基础接口
│   │   ├── netease.py     # 网易云音乐
│   │   └── bilibili.py    # B 站
│   ├── cli/               # 命令行
│   │   └── main.py        # CLI 入口
│   └── utils/             # 工具函数
│       ├── crypto.py      # 加密工具
│       └── logger.py      # 日志工具
├── config/                # 配置文件
│   ├── config.yaml        # 主配置
│   └── accounts.yaml      # 账号配置
├── data/                  # 数据目录
│   └── signin.db          # SQLite 数据库
├── docker/
│   └── Dockerfile         # Docker 配置
├── .github/
│   └── workflows/
│       └── signin.yml     # GitHub Actions
├── tests/                 # 测试
├── requirements.txt
├── pyproject.toml
└── README.md

🔧 配置说明

配置文件 (config/config.yaml)

# 应用配置
app:
  debug: false

# 定时任务
schedule:
  enabled: true
  time: "08:00"

# 通知
notification:
  enabled: true
  telegram:
    enabled: true
    bot_token: "xxx"
    chat_id: "xxx"

账号配置 (config/accounts.yaml)

accounts:
  - platform: netease
    username: "我的网易云"
    cookies: "MUSIC_U=xxx; __csrf=xxx"
    enabled: true
  
  - platform: bilibili
    username: "我的 B 站"
    cookies: "SESSDATA=xxx; bili_jct=xxx"
    enabled: true

📊 支持的平台

平台 状态 Cookie 要求
网易云音乐 ✅ 已支持 MUSIC_U, __csrf
哔哩哔哩 ✅ 已支持 SESSDATA, bili_jct
CSDN 🚧 计划中 -
淘宝 🚧 计划中 -
京东 🚧 计划中 -

🔔 通知系统

Telegram 通知

  1. 联系 @BotFather 创建机器人
  2. 获取 Bot Token
  3. 获取 Chat ID(联系 @userinfobot
  4. 配置到 .envconfig.yaml

邮件通知

notification:
  email:
    enabled: true
    smtp_server: "smtp.gmail.com"
    smtp_port: 587
    username: "your_email@gmail.com"
    password: "your_password"
    to_email: "receive_email@gmail.com"

Webhook 通知

notification:
  webhook:
    enabled: true
    url: "https://your-api.com/notify"
    method: "POST"

🧪 测试

# 安装测试依赖
pip install -e ".[dev]"

# 运行测试
pytest tests/

# 代码格式化
black src/
flake8 src/

🤝 贡献

欢迎提交 Issue 和 Pull Request!

# Fork 项目
git fork https://github.com/yourusername/autosignin

# 克隆到本地
git clone git@github.com:yourusername/autosignin.git

# 创建分支
git checkout -b feature/your-feature

# 提交代码
git commit -m "Add: your feature"

# 推送
git push origin feature/your-feature

📝 更新日志

v2.0.0 (2026-03-08)

  • 🎉 完全重构,删除 GUI
  • ✨ 添加 CLI 命令行界面
  • 🐳 支持 Docker 部署
  • ☁️ 支持 GitHub Actions
  • 📊 添加数据库支持
  • 🔔 添加多渠道通知
  • 🔧 优化配置系统

v1.0.0 (旧版本)

  • 基础功能实现
  • tkinter GUI 界面
  • 支持 9 个平台

📄 许可证

MIT License


🙏 致谢

感谢以下开源项目:


📮 联系方式


⭐ 如果这个项目对你有帮助,请给一个 Star!

About

在当今数字化时代,拥有一个强大的自动签到系统十分必要。它能覆盖市面上哔哩哔哩、网易云音乐等主流软件,便捷高效。

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors