name: hongguo-douyin-video-api-tricks description: >- Comprehensive runbook, free API tricks, multi-provider rotation architecture, and CENC-AES-128-CTR (spade_a) MP4 decryption guide for Hongguo Short Drama (红果免费短剧 / Fanqie Novel / qznovelvod) and Douyin/TikTok video downloaders on Cloudflare Pages/Workers Free and Python Render.com. Activate this skill when building, debugging, or extending video parsers, short-drama scrapers, or ByteDance VOD decryptors.
novelquickapp.com/s/..., changdunovel.com):
GET request with redirect: "manual" and mobile User-Agent.Location header query string for video_series_id, series_id, book_id, album_id, group_id, item_id, or vid (19-digit numeric IDs).hongguoduanju.com):
https://hongguoduanju.com/detail?series_id={19_digit_id}https://hongguoduanju.com/player/{series_id}/{vid}X-Gorgon via Official Fqnovel App Preload MirrorsStandard Fqnovel/Hongguo mobile endpoints enforce ByteDance X-Gorgon / X-Argus signatures. However, the Preload v1 endpoints across 6 official mirrors accept unauthenticated POST requests when passed the standard Android preload query parameters and "dr_scene": "preload":
https://api5-normal-sinfonlineb.fqnovel.comhttps://api5-normal-sinfonlinea.fqnovel.comhttps://api5-normal-sinfonlinec.fqnovel.comhttps://api5-normal-lf.fqnovel.comhttps://api5-normal-lq.fqnovel.comhttps://api5-normal-hl.fqnovel.comCOMMON_APP_QUERY): klink_egdi=AAI29o4dI-eMiO73_SRSbZ_0By1v3fUSriNeu8-L951MoXhWT88pzj5B&iid=3788260546453235&device_id=538083340353620&ac=wifi&channel=oppo_8662_64&aid=8662&app_name=novelread&version_code=71532&version_name=7.1.5.32&device_platform=android&os=android&ssmix=a&device_type=SM-N9860&device_brand=Samsung&language=zh&os_api=28&os_version=9&manifest_version_code=71532&resolution=900*1600&dpi=320&update_version_code=71532&host_abi=arm64-v8a&dragon_device_type=pad&pv_player=71532&compliance_status=0&need_personal_recommend=1&player_so_load=1&is_android_pad_screen=0User-Agent: com.phoenix.read/71532 (Linux; U; Android 9; SM-N9860; Build/PQ3A.190705.10241111;tt-ok/3.12.13.20)Referer: https://novelquickapp.com/POST /novel/player/multi_video_detail/preload/v1?{COMMON_APP_QUERY}{
"biz_param": {
"detail_page_version": 0,
"disable_digg_stat": false,
"need_all_video_definition": false,
"need_mp4_align": false,
"screen_width_px": "900",
"source": 7,
"use_os_player": false,
"use_server_dns": false
},
"dr_scene": "preload",
"series_id": "7588802892412406808"
}data[series_id].video_data (series_title, series_cover, series_intro, episode_cnt, celebrities, and video_list containing all episode vid, vid_index, duration).spade_a Keys:
POST /novel/player/multi_video_model/preload/v1?{COMMON_APP_QUERY}{
"biz_param": {
"detail_page_version": 0,
"device_level": 3,
"disable_digg_stat": false,
"need_all_video_definition": true,
"need_mp4_align": false,
"use_os_player": false,
"use_server_dns": false,
"video_platform": 1024
},
"dr_scene": "preload",
"mixed_video_id_map": { "1004": ["7588804476701690904"] }
}data[vid].video_model (JSON string). Inside video_list (video_1 to video_5), each item contains definition (360p..1080p), main_url, backup_url, encrypt_info.spade_a, plus fallback_api (https://vas-lf-x.snssdk.com/video/fplay/1/...).window._ROUTER_DATA) & Direct H.264 Streamwindow._ROUTER_DATA:
https://hongguoduanju.com/ pages with standard Desktop Browser UA:
https://hongguoduanju.com/ (loaderData.page.homeSections)https://hongguoduanju.com/category/{real-drama|comic-drama|ai-drama} (loaderData.category_page.recommendList)https://hongguoduanju.com/search/{encodeURIComponent(keyword)} (loaderData["search_(keyword)/page"].searchList)https://hongguoduanju.com/detail?series_id={seriesId} (seriesDetail.vid_list)_ROUTER_DATA via brace-balanced parsing starting at the first { after _ROUTER_DATA.360p-h264):
vid has a direct unencrypted H.264/AAC MP4 endpoint: https://hongguoduanju.com/video/public/{vid}/360p.mp4Referer: https://hongguoduanju.com/.<video> preview in browsers (since browsers cannot natively play CENC-encrypted encv streams without EME/MSE).spade_a Key Derivation & Fast WebCrypto CENC-AES-128-CTR Decryptionspade_a to 16-Byte AES Key (key_hex — libttmplayer.so algorithm):
spade_a into buf (L = buf.length).key0 = buf[0] ^ buf[1] ^ buf[2], x27 = key0 - 0x30, w22 = L - key0 + 0x2f.x21 = buf.slice(1, 1 + w22). Initialize w11 = 0x55, w12 = 0xfa, w10 = 0xeb.i, compute popcount pc = popcount(i), w14 = (i & 1) === 0 ? w12 : w11, update w11/w12 with x21[i], and set x21[i] = ((w10 - pc) + (w14 ^ x21[i])) & 0xff.hval from x21[0], compute w9 = w22 - hval, and extract ASCII hex string x21.slice(1, w9) (32 hex chars = 16-byte AES key).cenc MP4 (encv -> hvc1, enca -> mp4a):
moov box and iterate over each trak -> mdia -> minf -> stbl:
stsz (sample sizes), stsc (sample-to-chunk), stco (chunk offsets), and senc (8-byte IV per sample at senc.off + 16 + i * 8).counter[0..7] = iv8, counter[8..15] = 0) and decrypt each sample with crypto.subtle.decrypt({ name: "AES-CTR", counter, length: 64 }, cryptoKey, sampleSlice).moov:
encv -> hvc1, enca -> mp4a, remove sinf, senc, saio, saiz boxes, and subtract delta = oldMoovSize - newMoovSize from every offset in stco that follows moov (or overwrite sinf/senc/saio/saiz in-place with free boxes to keep moov size constant)./api/download?url=...&raw=1 (streaming passthrough with Referer: https://novelquickapp.com/).CENC-AES-128-CTR decryption in the browser via window.HongguoClientDecryptor using hardware-accelerated WebCrypto (0ms Worker CPU cost), while keeping server-side decryption in /api/download and Python app.py (Render.com with pycryptodome) as fallback.TikWM (https://www.tikwm.com/api/, POST url=...&hd=1) — no cooldown.Apihz 4 routes (https://cn.apihz.cn/api/fun/douyin.php + 3 HTTP IP mirrors proxied server-side via Cloudflare Worker to avoid browser HTTPS Mixed-Content blocking).api.cenguigui.cn/api/duanju.html is deprecated (HTTP 404); keep only as last-resort fallback.To achieve <2ms Edge delivery, zero CPU overruns, and prevent burning the 100,000/day Cloudflare Free Worker invocation quota:
public/_routes.json):
"include": ["/api/*"] and "exclude": ["/", "/index.html", "/articles.js", "/ads.txt", "/robots.txt", "/sitemap.xml", "/favicon.svg"].INFLIGHT_MAP):
MEM_CACHE. If a request arrives after soft TTL expires but within hard TTL (3x), return cached data instantly (0.0ms) and trigger an asynchronous background refresh via ctx.waitUntil.sinfonlineb, sinfonlinea, sinfonlinec, lf, lq, hl).650ms parallel timeout./novel/player/multi_video_model/preload/v1 accepts up to 15 VIDs in mixed_video_id_map: { "1004": [vid1, vid2, ... vid15] }./api/parse call and during batch downloads via /api/episode?vids=...&indices=..., cutting 93% of API roundtrips.wrangler.toml):
[placement] mode = "smart" so Cloudflare executes Workers at Edge datacenters near ByteDance/Hongguo Asian upstreams, reducing multi-hop network latency by 40-70%.caches.default):
/api/proxy) for 30 days (immutable) and small decrypted MP4s (<= 20MB) for 1-2 hours so repeated requests and range requests serve directly from Edge RAM.*.qznovelvod.com (ByteDance VOD CDN for 1080p CENC MP4) and *.byteimg.com (cover image CDN) return HTTP 200 with header: Access-Control-Allow-Origin: * when requested without a Referer header (referrerPolicy: "no-referrer").fetch(rawVideoUrl, { referrerPolicy: "no-referrer" }) and only fall back to /api/download?url=...&raw=1 if CORS fails.<img src="direct_byteimg_url" referrerpolicy="no-referrer" onerror="this.src='/api/proxy?url=...'"/>.crypto.subtle.decrypt for 12,000+ tiny samples creates 12,000+ Promise allocations, causing severe event-loop overhead and hitting Cloudflare Worker 10ms CPU limits (Error 1102).AES_TE0..TE3, AES_SBOX).crypto.subtle.decrypt.Blob Web Worker with zero-copy Transferable ArrayBuffer (postMessage(..., [u8.buffer])).该接口免费用户限制30秒解析1次).https://cn.apihz.cn/api/fun/douyin.php (raw IPs like 101.35.2.25 fail across firewalls).getOrSetCache(cacheKey, 1800, ...)) using canonical aweme_id or resolved URL. Subsequent hits return in and bypass the 30s rate limit completely.v.douyin.com with redirect: "manual" in ~200ms to get canonical aweme_id.raceWithHedge(primary, backups, 1200).