Skip to content

Commit

Permalink
fix transfer error
Browse files Browse the repository at this point in the history
  • Loading branch information
qjfoidnh committed Dec 13, 2024
1 parent 13342ad commit 624ac21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
3 changes: 0 additions & 3 deletions baidupcs/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"regexp"
"strconv"
"strings"
"time"
)

type (
Expand All @@ -31,8 +30,6 @@ func (pcs *BaiduPCS) GenerateShareQueryURL(subPath string, params map[string]str
Path: "/share/" + subPath,
}
uv := shareURL.Query()
uv.Set("time", strconv.Itoa(int(time.Now().UnixMilli())))
uv.Set("clienttype", "1")
for key, value := range params {
uv.Set(key, value)
}
Expand Down
33 changes: 18 additions & 15 deletions internal/pcscommand/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"regexp"
"strconv"
"strings"
"time"
)

// RunShareTransfer 执行分享链接转存到网盘
Expand Down Expand Up @@ -48,14 +49,15 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) {
fmt.Printf("%s失败: %s\n", baidupcs.OperationShareFileSavetoLocal, tokens["ErrMsg"])
return
}
// pcs.UpdatePCSCookies(true)
var vefiryurl string
featuremap := make(map[string]string)
featuremap["shareid"] = tokens["shareid"]
featuremap["uk"] = tokens["share_uk"]

if extracode != "none" {
vefiryurl = pcs.GenerateShareQueryURL("verify", featuremap).String()
res := pcs.PostShareQuery(vefiryurl, link, map[string]string{
verifyUrl := pcs.GenerateShareQueryURL("verify", map[string]string{
"shareid": tokens["shareid"],
"time": strconv.Itoa(int(time.Now().UnixMilli())),
"clienttype": "1",
"uk": tokens["share_uk"],
}).String()
res := pcs.PostShareQuery(verifyUrl, link, map[string]string{
"pwd": extracode,
"vcode": "null",
"vcode_str": "null",
Expand All @@ -73,14 +75,15 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) {
fmt.Printf("%s失败: %s\n", baidupcs.OperationShareFileSavetoLocal, tokens["ErrMsg"])
return
}

featuremap["bdstoken"] = tokens["bdstoken"]
featuremap["root"] = "1"
featuremap["web"] = "5"
featuremap["app_id"] = "250528"
featuremap["shorturl"] = featureStr[1:]
featuremap["channel"] = "chunlei"
queryShareInfoUrl := pcs.GenerateShareQueryURL("list", featuremap).String()
featureMap := map[string]string{
"bdstoken": tokens["bdstoken"],
"root": "1",
"web": "5",
"app_id": "250528",
"shorturl": featureStr[1:],
"channel": "chunlei",
}
queryShareInfoUrl := pcs.GenerateShareQueryURL("list", featureMap).String()
transMetas := pcs.ExtractShareInfo(queryShareInfoUrl, tokens["shareid"], tokens["share_uk"], tokens["bdstoken"])

if transMetas["ErrMsg"] != "success" {
Expand Down

0 comments on commit 624ac21

Please sign in to comment.