Skip to content

feat(bilibili): support b23.tv short URL/short code resolution#740

Merged
jackwener merged 2 commits intojackwener:mainfrom
sa1ka:feat/bilibili-short-url
Apr 3, 2026
Merged

feat(bilibili): support b23.tv short URL/short code resolution#740
jackwener merged 2 commits intojackwener:mainfrom
sa1ka:feat/bilibili-short-url

Conversation

@sa1ka
Copy link
Copy Markdown
Contributor

@sa1ka sa1ka commented Apr 3, 2026

Summary

Add resolveBvid() in utils.ts to automatically resolve b23.tv short URLs and short codes to BV IDs.

Supported input formats

  • BV ID: BV1MV9NBtENN (pass through, no overhead)
  • Short code: XYzsqGa
  • Short URL: https://b23.tv/XYzsqGa, b23.tv/XYzsqGa

How it works

Uses Node.js https.get to read only the 302 redirect Location header (~100-250ms, no body download).

Applied to

  • subtitle command
  • comments command
  • download command

Test

All three input formats produce identical results (104 subtitle items).

chenruinian and others added 2 commits April 3, 2026 22:34
Add resolveBvid() in utils.ts to automatically resolve b23.tv short URLs
and short codes to BV IDs. Supports all input formats:
- BV ID: BV1MV9NBtENN (pass through)
- Short code: XYzsqGa
- Short URL: https://b23.tv/XYzsqGa, b23.tv/XYzsqGa

Uses Node.js https.get with 302 redirect only (no body download),
typically ~100-250ms resolution time.

Applied to: subtitle, comments, download commands.
- 5s timeout on https.get to prevent hanging on unresponsive b23.tv
- Accept unknown input type with String() coercion
- Simplify callers (remove redundant String().trim() wrappers)
- Add unit tests for BV ID passthrough and edge cases
@jackwener jackwener merged commit 8070960 into jackwener:main Apr 3, 2026
just-buer pushed a commit to just-buer/opencli that referenced this pull request Apr 8, 2026
…ener#740)

* feat(bilibili): support b23.tv short URL/short code resolution

Add resolveBvid() in utils.ts to automatically resolve b23.tv short URLs
and short codes to BV IDs. Supports all input formats:
- BV ID: BV1MV9NBtENN (pass through)
- Short code: XYzsqGa
- Short URL: https://b23.tv/XYzsqGa, b23.tv/XYzsqGa

Uses Node.js https.get with 302 redirect only (no body download),
typically ~100-250ms resolution time.

Applied to: subtitle, comments, download commands.

* fix: add timeout, input coercion, and tests for resolveBvid

- 5s timeout on https.get to prevent hanging on unresponsive b23.tv
- Accept unknown input type with String() coercion
- Simplify callers (remove redundant String().trim() wrappers)
- Add unit tests for BV ID passthrough and edge cases

---------

Co-authored-by: chenruinian <chenruinian@Sa1kas-MacBookPro.local>
Co-authored-by: jackwener <jakevingoo@gmail.com>
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.

2 participants