diff --git a/baidupcs/transfer.go b/baidupcs/transfer.go index 36f9820..736ad47 100644 --- a/baidupcs/transfer.go +++ b/baidupcs/transfer.go @@ -12,7 +12,6 @@ import ( "regexp" "strconv" "strings" - "time" ) type ( @@ -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) } diff --git a/internal/pcscommand/transfer.go b/internal/pcscommand/transfer.go index ac1a063..97e7c96 100644 --- a/internal/pcscommand/transfer.go +++ b/internal/pcscommand/transfer.go @@ -8,6 +8,7 @@ import ( "regexp" "strconv" "strings" + "time" ) // RunShareTransfer 执行分享链接转存到网盘 @@ -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", @@ -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" {