Install
openclaw skills install nexus-ciba-wechatgenerate shareable html and png cards from the ciba or iciba daily sentence api. use when the user asks for 词霸每日一句, iciba, ciba, open.iciba.com/dsapi, daily english sentence cards, magazine torn-paper cards, friends circle or moments poster layouts, postcard horizontal cards, qr codes for tts pronunciation audio, multi-template html customization, or playwright rendering of these cards to png.
openclaw skills install nexus-ciba-wechatUse this skill to create polished HTML and PNG cards from the 词霸每日一句 API at https://open.iciba.com/dsapi/. The bundled renderer supports multiple HTML templates, including a vertical friends-circle card and a horizontal postcard-style card, with QR codes that encode the API tts audio URL.
scripts/render_iciba_card.py unless the user explicitly asks for hand-written HTML only.https://open.iciba.com/dsapi/ by default.picture, picture2, picture3, picture4.tts into the QR code. Do not encode the page URL unless the user explicitly asks.moments_vertical by default.Run from the skill directory or pass the script path directly:
python scripts/render_iciba_card.py --output-dir /mnt/data/iciba-card
List available templates:
python scripts/render_iciba_card.py --list-templates
Render the default vertical friends-circle card:
python scripts/render_iciba_card.py \
--template moments_vertical \
--output-dir /mnt/data/iciba-card
Render the horizontal postcard card:
python scripts/render_iciba_card.py \
--template postcard_horizontal \
--output-dir /mnt/data/iciba-postcard
Useful options:
python scripts/render_iciba_card.py \
--template postcard_horizontal \
--output-dir /mnt/data/iciba-postcard \
--width 1200 \
--height 760 \
--api-url https://open.iciba.com/dsapi/
For testing or reproducibility without live network access, pass a JSON file:
python scripts/render_iciba_card.py --input-json /mnt/data/iciba.json --output-dir /mnt/data/iciba-card
Expected outputs in the output directory:
<output_stem>.html<output_stem>.png<output_stem>_data.jsonhero_source.txtDefault output stems:
moments_vertical -> iciba_moments_cardpostcard_horizontal -> iciba_postcard_horizontalHTML is separated from Python and stored in templates/:
templates/moments_vertical.html: 9:16 friends-circle card, image above and text below.templates/postcard_horizontal.html: horizontal postcard-style card, photo left and message/stamp area right.Templates use simple replacement tokens rather than a templating dependency. Supported tokens include:
[[WIDTH]], [[HEIGHT]], [[TEMPLATE_NAME]][[CAPTION]], [[CONTENT]], [[NOTE]], [[TRANSLATION]], [[DATELINE]][[ISSUE_DAY]], [[ISSUE_TEXT]], [[QUOTE_SIZE]][[HERO_URI]], [[HERO_ALT]], [[HERO_SOURCE]], [[HERO_FIELD]], [[HERO_URL]][[QR_URI]], [[TTS_URL]], [[STATUS]]To add a new template, create a new HTML file under templates/, add an entry to TEMPLATE_CONFIG in scripts/render_iciba_card.py, then test with --template <name>.
For moments_vertical:
540 x 960 CSS pixels.For postcard_horizontal:
1200 x 760 CSS pixels.POST CARD, address lines, a stamp area, and a QR voice stamp.For all templates:
tts, not on the HTML page URL, unless explicitly requested otherwise.Use these fields from the API:
caption -> label, default 词霸每日一句content -> main English quotenote -> Chinese translationtranslation -> small source line, default 新版每日一句dateline -> displayed date and issue badgetts -> QR code payloadpicture, picture2, picture3, picture4 -> image candidates, in that priority orderSee references/iciba-api-fields.md for more details.
The Python renderer keeps pathlib.Path for real filesystem operations, but formats logged and serialized output paths with the native OS separator. Windows uses \; Linux, macOS, and other POSIX-like systems use /. The generated data JSON includes _path_separator and _output_dir for debugging.
If the API fetch fails, use the built-in fallback data and clearly state that the run used fallback data. If the API returns text but image download fails, still use the API text and tts, but use the generated fallback image. Do not claim that the visible image came from an API picture unless hero_source.txt says api_picture and includes the selected picture field and URL.