Skip to content

feat: add --image support to dynamic-post - #19

Open
JupiterTheWarlock wants to merge 1 commit into
public-clis:mainfrom
JupiterTheWarlock:feat/dynamic-post-image
Open

feat: add --image support to dynamic-post#19
JupiterTheWarlock wants to merge 1 commit into
public-clis:mainfrom
JupiterTheWarlock:feat/dynamic-post-image

Conversation

@JupiterTheWarlock

Copy link
Copy Markdown

Summary

Add image upload support to the dynamic-post command, enabling text+image dynamics.

Changes

  • bili_cli/commands/collections.py: Added --image option to dynamic-post command (can be specified multiple times, max 9 images)
  • bili_cli/client.py: Updated post_text_dynamic() to accept an images parameter, using Picture.from_file() + upload() from bilibili_api

Usage

# Text + images
bili dynamic-post "Hello world" --image photo1.jpg --image photo2.png --yaml

# Images only (no text)
bili dynamic-post --image photo.jpg --yaml

# Text only (existing behavior, unchanged)
bili dynamic-post "Just text" --yaml

Notes

  • The underlying bilibili_api library already supports BuildDynamic.add_image() — this PR simply exposes it through the CLI
  • Images are uploaded to Bilibili's image hosting via Picture.upload() before being attached to the dynamic
  • Max 9 images per dynamic (B站 limit)

Testing

Tested with text+2 images dynamic post on real Bilibili account — works correctly.

- Add --image option (multiple, max 9) to dynamic-post CLI command
- Update post_text_dynamic() in client.py to accept images parameter
- Use bilibili_api Picture.from_file() + upload() for image handling
- Support text-only, image-only, and text+image dynamics
- Update help text from '纯文本动态' to '图文动态'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant