WWeydub API

API guide

Quickstart

This quickstart submits a Weydub video text removal task and polls until a result is ready. It is intentionally small so a human developer or AI coding tool can copy it into a backend script and verify credentials quickly.

Prerequisites

  • A Weydub account. Signed-in users can open API access for free from My Account.
  • AppKey and AppSecret.
  • A publicly reachable video URL. Supported formats include mp4, avi, mov, mkv, mpg, m3u8, and m4v.
bash
export WEYDUB_APP_KEY="your_app_key"
export WEYDUB_APP_SECRET="your_app_secret"

Python Example

python
import hashlib
import json
import os
import time

import requests

APP_KEY = os.environ["WEYDUB_APP_KEY"]
APP_SECRET = os.environ["WEYDUB_APP_SECRET"]
BASE_URL = "https://api.zhaoli.com"


def api_post(path: str, payload: dict) -> dict:
    body = json.dumps(payload, ensure_ascii=False, separators=(",", ":"))
    body_md5 = hashlib.md5(body.encode("utf-8")).hexdigest()
    app_sign = hashlib.md5((body_md5 + APP_SECRET).encode("utf-8")).hexdigest()
    headers = {
        "Content-Type": "application/json",
        "AppKey": APP_KEY,
        "AppSign": app_sign,
    }
    response = requests.post(f"{BASE_URL}{path}", headers=headers, data=body, timeout=30)
    response.raise_for_status()
    return response.json()


create_res = api_post(
    "/v-w-c/gateway/ve/work/free",
    {
        "urls": ["https://example.com/demo.mp4"],
        "needChineseOcclude": 1,
        "videoInpaintLang": "all",
    },
)

work_id = create_res["body"]["dataList"][0]["id"]
print("Created work:", work_id)

while True:
    status_res = api_post("/v-w-c/gateway/ve/work/status", {"idWorks": [work_id]})
    item = status_res["body"]["content"][0]
    process_status = item["processStatus"]

    if process_status == 1:
        print("Done:", item.get("videoUrl"))
        break
    if process_status > 1:
        raise RuntimeError(item.get("errorDetail") or "Task failed")

    print("Processing...")
    time.sleep(10)

Next Steps

  • Add a callback URL when you need production-grade async handling.
  • Store returned media URLs quickly; generated assets follow the platform retention policy.
  • Use uid if your app needs to separate workspaces by customer or tenant.
  • Run Demo scenarios before customer media.

For AI Coding Tools

Tell the assistant to:

  • Read Auth and signing before editing code.
  • Keep credentials in WEYDUB_APP_KEY and WEYDUB_APP_SECRET.
  • Build a backend-only client; do not call Weydub from browser code with AppSecret.
  • Sign the exact compact JSON body being sent.
  • Add a dry-run mode that prints endpoint and payload without printing secrets.