fix: 修复标题长度计算不准确的问题 (#410)

使用基于 UTF-16 编码的加权算法替换 go-runewidth,与小红书实际计算规则一致:
非ASCII字符算2字节,ASCII字符算1字节,向上取整除以2。

Closes #401

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
zy
2026-02-10 23:04:12 +08:00
committed by GitHub
parent db3dd37cb8
commit a790a97c93
5 changed files with 58 additions and 13 deletions

2
go.mod
View File

@@ -7,7 +7,6 @@ require (
github.com/gin-gonic/gin v1.10.1
github.com/go-rod/rod v0.116.2
github.com/h2non/filetype v1.1.3
github.com/mattn/go-runewidth v0.0.16
github.com/modelcontextprotocol/go-sdk v0.7.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
@@ -37,7 +36,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect