Skip to content

Commit

Permalink
修复小红书部分图集有水印,不清晰; fix #49
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunwei928 committed Dec 22, 2024
1 parent 5d6f9f7 commit 1a2a63f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* [Docker](#docker)
* [依赖模块](#依赖模块)

Golang短视频去水印, 视频目前支持20个平台, 图集目前支持3个平台, 欢迎各位Star。
Golang短视频去水印, 视频目前支持20个平台, 图集目前支持4个平台, 欢迎各位Star。
> ps: 使用时, 请尽量使用app分享链接, 电脑网页版未做测试.
# 其他语言版本
Expand All @@ -15,6 +15,7 @@ Golang短视频去水印, 视频目前支持20个平台, 图集目前支持3个
|-----|----|
| 抖音 ||
| 快手 ||
| 小红书 ||
| 皮皮虾 ||

## 视频
Expand Down
12 changes: 11 additions & 1 deletion parser/redbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"regexp"
"strings"

"github.com/tidwall/gjson"

Expand Down Expand Up @@ -42,7 +43,16 @@ func (r redBook) parseShareUrl(shareUrl string) (*VideoParseInfo, error) {
for _, imageItem := range imagesObjArr {
imageUrl := imageItem.Get("urlDefault").String()
if len(imageUrl) > 0 {
images = append(images, imageUrl)
imgId := strings.Split(imageUrl[strings.LastIndex(imageUrl, "/")+1:], "!")[0]
// 如果链接中带有 spectrum/ , 替换域名时需要带上
spectrumStr := ""
if strings.Contains(imageUrl, "spectrum") {
spectrumStr = "spectrum/"
}
newUrl := fmt.Sprintf("https://ci.xiaohongshu.com/%s%s?imageView2/2/w/0/format/jpg", spectrumStr, imgId)
fmt.Println(imageUrl)
fmt.Println(newUrl)
images = append(images, newUrl)
}
}
}
Expand Down

0 comments on commit 1a2a63f

Please sign in to comment.