fqscfqj/Y2A-Auto
YouTube到AcFun和bilibili自动化搬运工具,支持AI翻译、字幕生成、内容审核、智能监控
Y2A‑Auto – YouTube → AcFun / Bilibili Auto‑Reposter
What it is – A self‑hosted Python/Flask application that automates the whole pipeline for taking a YouTube video, generating (or translating) subtitles with AI‑powered speech‑to‑text, polishing the text with optional OpenAI‑based quality checks, and uploading the finished video to Chinese video platforms (AcFun, Bilibili, or both). It also includes a web UI, YouTube‑channel/keyword monitoring, notification hooks, and a few security niceties.
Core capabilities (as listed in the README)
| Module | What it does |
|---|---|
| Full‑process automation | yt‑dlp download → optional Whisper/Voxtral ASR → subtitle translation & QC → AI‑generated title/description/tags → content‑moderation (Aliyun Green) → upload to AcFun/Bilibili. |
| Web management UI | Task list, manual review, forced upload, settings grouped by function (accounts, AI, subtitles, encoding, monitoring, security). |
| YouTube monitor | Periodic fetch of new videos by channel or keyword, with latest or historical modes, auto‑queueing. |
| Notification | Asynchronous push to WeChat Work, Server‑Chan, or message‑pusher for events such as task added/completed/failed, login success/failure, QR‑login results. |
| CookieCloud sync | Pull YouTube/Google cookies from a CookieCloud server (auto/legacy/AES‑128‑CBC modes) to keep authentication up‑to‑date. |
| Subtitle engine | Line‑splitting, punctuation normalisation, filler‑word removal, hallucination detection, timing adjustments, optional hard‑burn into video. |
| Video transcoding | CPU or hardware‑accelerated (NVIDIA, Intel, AMD) encoding, prefers HEVC/H.265 then falls back to H.264. |
| Security | Optional password protection, brute‑force lockout, session timeout, path‑traversal safeguards, persistent secret key. |
| Maintenance | Log/download cleanup, concurrent‑task limits, automatic FFmpeg download on Windows. |
How it works (high‑level flow)
- Create a task – Paste a YouTube URL in the UI (or let the monitor add one). The task is stored in a SQLite DB.
- Download –
yt‑dlpfetches the video, thumbnail and (optional) auto‑generated YouTube subtitles. - ASR (optional) – If enabled, Whisper or Voxtral transcribes the audio into a source subtitle file.
- Subtitle processing – The engine cleans the text, splits long lines, removes filler words, and can run an OpenAI‑based quality‑check.
- Translation (optional) – Cleaned subtitles are sent in batches to an OpenAI model (or compatible endpoint) for translation to the target language (default Chinese).
- AI‑generated metadata – Using the same OpenAI model the system can draft a title, description, tags and recommend a platform partition.
- Content moderation – If turned on, the generated text is sent to Alibaba Cloud Green for compliance checking.
- Encoding – Video is re‑encoded with FFmpeg; hardware encoders are tried first, with automatic fallback.
- Upload – The final video (with optional hard‑burned subtitles) is uploaded to AcFun, Bilibili, or both via their respective APIs (QR‑code login or cookie‑based auth).
- Post‑process – Logs and downloads can be auto‑cleaned; notifications are dispatched for the task’s outcome.
Deployment options
| Mode | Steps |
|---|---|
| Docker (recommended) | docker compose up -d (pulls fqscfqj/y2a-auto:latest). Mounts config/, db/, downloads/, logs/, cookies/, temp/. GPU support can be enabled by uncommenting the gpus: section for NVIDIA or adding /dev/dri for Intel/AMD. |
| Local Python | Create a venv, pip install -r requirements.txt, ensure FFmpeg & yt‑dlp are on PATH, then python app.py. |
| Windows portable | Use the pre‑built release in build-tools/ which bundles FFmpeg; run the executable directly. |
All modes support the same config/config.json file for toggling features (AI, ASR, monitoring, notifications, etc.).
Configuration highlights (most‑used knobs)
- Authentication – Place YouTube, AcFun and Bilibili cookies under
cookies/(or enable CookieCloud sync). QR‑code login is available from the UI. - AI – Set
OPENAI_API_KEY,OPENAI_BASE_URLandOPENAI_MODEL_NAME. Separate overrides exist for subtitle translation (SUBTITLE_OPENAI_*) and QC (SUBTITLE_QC_*). - ASR – Enable with
SPEECH_RECOGNITION_ENABLED; choose provider (whisperorvoxtral). VAD (VAD_ENABLED) improves segmentation. - Subtitle translation – Toggle with
SUBTITLE_TRANSLATION_ENABLED; control batch size, concurrency, and retry policy. - Video encoder –
VIDEO_ENCODER=auto|cpu|nvidia|intel|amd; hardware encoders automatically select HEVC, falling back to H.264. - Monitoring – Provide a YouTube Data API key (
YOUTUBE_API_KEY) and configure channels/keywords in the UI. - Notifications – Set
NOTIFY_ENABLED=trueand fill the webhook/SendKey for the desired channels. - Security – Turn on
password_protection_enabledand adjust lockout thresholds.
Who might use it
- Content creators who want to republish their own YouTube videos on Chinese platforms without manual re‑encoding and caption work.
- Media teams needing bulk migration of archival YouTube content, with optional AI‑assisted translation and compliance checks.
- Researchers / hobbyists interested in a turnkey example of a multi‑stage media‑processing pipeline that combines open‑source tools (
yt‑dlp, FFmpeg, Whisper) with LLM services.
License & community
- Licensed under GPL‑v3.
- Contributions are welcomed via Issues/PRs; sensitive data (cookies, keys) must never be committed.
- The project credits several upstream tools (yt‑dlp, FFmpeg, Flask, OpenAI, etc.) and provides a Telegram bot for quick testing.
Bottom line: Y2A‑Auto is a genuine, AI‑enhanced automation suite for moving YouTube videos to AcFun/Bilibili, offering end‑to‑end processing, optional AI subtitle generation/translation, and a secure, Docker‑friendly deployment.
Related
- Project
- Project
- Project
- Project