CLI Upload to YouTube and WeChat | Generated by AI

Home 2026.07

Question: Could we use a CLI tool to upload videos to WeChat Channels or YouTube?

Answer:

Yes for YouTube. For WeChat Channels (微信视频号), it is much harder because there is no public upload API, but browser automation can work.

1. YouTube: official CLI-friendly way

YouTube has a mature API:

A minimal Python uploader:

pip install google-api-python-client google-auth-oauthlib

Example:

from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from google_auth_oauthlib.flow import InstalledAppFlow

SCOPES = ["https://www.googleapis.com/auth/youtube.upload"]

flow = InstalledAppFlow.from_client_secrets_file(
    "client_secret.json",
    SCOPES
)

credentials = flow.run_local_server(port=8080)

youtube = build(
    "youtube",
    "v3",
    credentials=credentials
)

request = youtube.videos().insert(
    part="snippet,status",
    body={
        "snippet": {
            "title": "My AI Experiment",
            "description": "Training GPT model from scratch",
            "tags": ["AI", "LLM"]
        },
        "status": {
            "privacyStatus": "public"
        }
    },
    media_body=MediaFileUpload(
        "video.mp4",
        chunksize=-1,
        resumable=True
    )
)

response = request.execute()

print(response["id"])

Then wrap it:

yt-upload video.mp4 \
  --title "GPT-2 training on RTX4070" \
  --public

This is basically how content farms and AI media pipelines work.


2. WeChat Channels: no official public API

微信视频号 is different.

Tencent provides APIs for:

But not a general “upload video to personal Video Channel” API.

Possible approaches:

Option A: Browser automation (most practical)

Use:

Example architecture:

video.mp4
    |
    v
ffmpeg preprocessing
    |
    v
Playwright
    |
    v
wechat.com / creator platform
    |
    v
upload
    |
    v
publish

Pseudo:

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)

    page = browser.new_page()

    page.goto(
        "https://channels.weixin.qq.com/platform"
    )

    # login manually first

    page.set_input_files(
        "input[type=file]",
        "video.mp4"
    )

    page.fill(
        "#title",
        "My AI Agent Demo"
    )

    page.click(
        "text=发布"
    )

The problem:


Option B: Internal/private APIs

Some tools reverse engineer WeChat APIs.

Typical pattern:

CLI
 |
 | HTTP
 |
WeChat private endpoint
 |
Video Channel backend

But:

I would avoid for a serious account.


3. Building an AI content factory

For your “token factory / super-agent” idea, the practical stack:

                 LLM Agent
                    |
        +-----------+-----------+
        |                       |
   Script Agent             Metadata Agent
        |                       |
        v                       v
     ffmpeg              title/tag generator
        |
        v
    video.mp4
        |
 +------+------+
 |             |
YouTube     WeChat
 API        Playwright

CLI:

video-agent \
  --input blog.md \
  --voice elevenlabs \
  --model qwen \
  --publish youtube,wechat

Pipeline:

  1. Generate script with LLM
  2. Generate voice
  3. Create video with slides/screenshots
  4. Add subtitles
  5. Upload automatically

4. Existing open-source tools

For YouTube:

For video generation:


For your use case (AI engineering blog + experiments), I would build YouTube-first because the API is clean. Then add WeChat Channels through Playwright only as a distribution adapter. The core content factory should not depend on WeChat’s unstable UI.


Generated by AI. Curating and sharing still takes effort. If you find it useful, feel free to donate. WeChat: @lzwjavaWeChat QR · X: @lzwjava · Say hi 👋

Back Donate