From 2f33da036f54b10e3fd1d24a9bdf4394c334f093 Mon Sep 17 00:00:00 2001 From: qjfoidnh Date: Sat, 14 Dec 2024 03:25:05 +0800 Subject: [PATCH] v3.9.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关闭秒传功能 修复转存失败问题 --- README.md | 15 ++++++--------- baidupcs/transfer.go | 4 ++-- internal/pcscommand/transfer.go | 20 ++++++++++---------- main.go | 20 ++++++++++---------- versioninfo.json | 8 ++++---- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index b608f93..7668a49 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,10 @@ iikira/BaiduPCS-Go was largely inspired by [GangZhuo/BaiduPCS](https://github.co [离线下载](#离线下载), 支持http/https/ftp/电驴/磁力链协议. # 版本更新 +**2024.12.14** v3.9.6 +- 关闭秒传转存功能 +- 修复常规转存失败 + **2023.09.30** v3.9.5 - 恢复秒传转存功能, 使用前需设置accessToken, 参见setastoken --help - 本地文件上传用秒传无须accessToken @@ -671,7 +675,7 @@ BaiduPCS-Go sf <本地文件的路径> ``` -获取本地文件的大小, md5, 前256KB切片的 md5, crc32, 可用于秒传文件. +获取本地文件的大小, md5, 前256KB切片的 md5, crc32. #### 例子: @@ -697,13 +701,7 @@ BaiduPCS-Go ep <文件/目录1> <文件/目录2> ... #### 注意 -**无法导出 20GB 以上的文件!!** - -**无法导出文件的版本历史等数据!!** - -**以通用秒传格式导出会丢失文件路径信息!!** - -并不是所有的文件都能导出成功, 程序会列出无法导出的文件列表 +**秒传已不被支持, 该功能已无实际作用** #### 例子: @@ -801,7 +799,6 @@ BaiduPCS-Go mv /我的资源/1.mp4 /我的资源/3.mp4 ``` # 转存分享链接里的文件到当前目录: BaiduPCS-Go transfer <分享链接> <提取码> -BaiduPCS-Go transfer <秒传链接> ``` 注意: 转存文件保存到当前工作目录下, 不支持指定. diff --git a/baidupcs/transfer.go b/baidupcs/transfer.go index 736ad47..45626d0 100644 --- a/baidupcs/transfer.go +++ b/baidupcs/transfer.go @@ -124,9 +124,9 @@ func (pcs *BaiduPCS) AccessSharePage(featurestr string, first bool) (tokens map[ if !first { headers["Referer"] = fmt.Sprintf("https://pan.baidu.com/share/init?surl=%s", featurestr[1:]) } - sharelink := fmt.Sprintf("https://pan.baidu.com/s/%s", featurestr) + shareLink := fmt.Sprintf("https://pan.baidu.com/s/%s", featurestr) - dataReadCloser, panError := pcs.sendReqReturnReadCloser(reqTypePan, OperationShareFileSavetoLocal, http.MethodGet, sharelink, nil, headers) + dataReadCloser, panError := pcs.sendReqReturnReadCloser(reqTypePan, OperationShareFileSavetoLocal, http.MethodGet, shareLink, nil, headers) if panError != nil { tokens["ErrMsg"] = "访问分享页失败" diff --git a/internal/pcscommand/transfer.go b/internal/pcscommand/transfer.go index 97e7c96..5d4aeb9 100644 --- a/internal/pcscommand/transfer.go +++ b/internal/pcscommand/transfer.go @@ -14,22 +14,22 @@ import ( // RunShareTransfer 执行分享链接转存到网盘 func RunShareTransfer(params []string, opt *baidupcs.TransferOption) { var link string - var extracode string + var extraCode string if len(params) == 1 { link = params[0] if strings.Contains(link, "bdlink=") || !strings.Contains(link, "pan.baidu.com/") { - RunRapidTransfer(link, opt.Rname) - //fmt.Printf("%s失败: %s\n", baidupcs.OperationShareFileSavetoLocal, "秒传已不再被支持") + //RunRapidTransfer(link, opt.Rname) + fmt.Printf("%s失败: %s\n", baidupcs.OperationShareFileSavetoLocal, "秒传已不再被支持") return } - extracode = "none" + extraCode = "none" if strings.Contains(link, "?pwd=") { - extracode = strings.Split(link, "?pwd=")[1] + extraCode = strings.Split(link, "?pwd=")[1] link = strings.Split(link, "?pwd=")[0] } } else if len(params) == 2 { link = params[0] - extracode = params[1] + extraCode = params[1] } if link[len(link)-1:] == "/" { link = link[0 : len(link)-1] @@ -39,7 +39,7 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) { if strings.Contains(featureStr, "init?") { featureStr = "1" + strings.Split(featureStr, "=")[1] } - if len(featureStr) > 23 || featureStr[0:1] != "1" || len(extracode) != 4 { + if len(featureStr) > 23 || featureStr[0:1] != "1" || len(extraCode) != 4 { fmt.Printf("%s失败: %s\n", baidupcs.OperationShareFileSavetoLocal, "链接地址或提取码非法") return } @@ -50,7 +50,7 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) { return } - if extracode != "none" { + if extraCode != "none" { verifyUrl := pcs.GenerateShareQueryURL("verify", map[string]string{ "shareid": tokens["shareid"], "time": strconv.Itoa(int(time.Now().UnixMilli())), @@ -58,7 +58,7 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) { "uk": tokens["share_uk"], }).String() res := pcs.PostShareQuery(verifyUrl, link, map[string]string{ - "pwd": extracode, + "pwd": extraCode, "vcode": "null", "vcode_str": "null", "bdstoken": tokens["bdstoken"], @@ -79,7 +79,7 @@ func RunShareTransfer(params []string, opt *baidupcs.TransferOption) { "bdstoken": tokens["bdstoken"], "root": "1", "web": "5", - "app_id": "250528", + "app_id": baidupcs.PanAppID, "shorturl": featureStr[1:], "channel": "chunlei", } diff --git a/main.go b/main.go index bfba67d..b87de39 100644 --- a/main.go +++ b/main.go @@ -56,7 +56,7 @@ const ( var ( // Version 版本号 //Version = "v3.9.4-devel" - Version = "v3.9.5-devel" + Version = "v3.9.6-devel" historyFilePath = filepath.Join(pcsconfig.GetConfigDir(), "pcs_command_history.txt") reloadFn = func(c *cli.Context) error { @@ -604,8 +604,8 @@ func main() { }, }, { - Name: "setastoken", - Usage: "设定当前账号的accessToken", + Name: "setastoken", + Usage: "设定当前账号的accessToken", Description: ` 设定当前登录帐号的accessToken: 若不使用秒传链接转存, 可不设定; accessToken申请及获取教程: @@ -615,9 +615,9 @@ func main() { 示例: BaiduPCS-Go setastoken 156.182v9052tgf1006c89891bsfb2401974.YmKOAwBD9yGaG2s4p5NNkX4CXeIbJxx4hAxotfS.PyuHEs `, - Category: "百度帐号", - Before: reloadFn, - After: saveFunc, + Category: "百度帐号", + Before: reloadFn, + After: saveFunc, Action: func(c *cli.Context) error { activeUser := pcsconfig.Config.ActiveUser() if activeUser.UID == 0 { @@ -1161,7 +1161,7 @@ func main() { Usage: "将本地文件的修改时间设置为服务器上的修改时间", }, cli.IntFlag{ - Name: "dindex", + Name: "dindex", Usage: "使用备选下载链接中的第几个,默认第一个", }, cli.BoolFlag{ @@ -1519,8 +1519,8 @@ func main() { return nil } opt := &baidupcs.ShareOption{ - Password: c.String("p"), - Period: c.Int("period"), + Password: c.String("p"), + Period: c.Int("period"), IsCombined: c.Bool("f"), } pcscommand.RunShareSet(c.Args(), opt) @@ -1538,7 +1538,7 @@ func main() { Value: 0, }, cli.BoolFlag{ - Name: "f", + Name: "f", Usage: "输出带密码的完整链接格式", }, }, diff --git a/versioninfo.json b/versioninfo.json index ef84d0c..c16e71c 100644 --- a/versioninfo.json +++ b/versioninfo.json @@ -3,13 +3,13 @@ "FileVersion": { "Major": 3, "Minor": 9, - "Patch": 5, + "Patch": 6, "Build": 0 }, "ProductVersion": { "Major": 3, "Minor": 9, - "Patch": 5, + "Patch": 6, "Build": 0 }, "FileFlagsMask": "3f", @@ -22,14 +22,14 @@ "Comments": "", "CompanyName": "qjfoidnh", "FileDescription": "百度网盘客户端(加强版)", - "FileVersion": "v3.9.5", + "FileVersion": "v3.9.6", "InternalName": "", "LegalCopyright": "© 2016-2020 iikira.", "LegalTrademarks": "", "OriginalFilename": "", "PrivateBuild": "", "ProductName": "BaiduPCS-Go", - "ProductVersion": "v3.9.5", + "ProductVersion": "v3.9.6", "SpecialBuild": "" }, "VarFileInfo": {