Skip to content

Commit

Permalink
v3.9.6
Browse files Browse the repository at this point in the history
关闭秒传功能
修复转存失败问题
  • Loading branch information
qjfoidnh committed Dec 13, 2024
1 parent 624ac21 commit 2f33da0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -671,7 +675,7 @@ BaiduPCS-Go sf <本地文件的路径>
```

获取本地文件的大小, md5, 前256KB切片的 md5, crc32, 可用于秒传文件.
获取本地文件的大小, md5, 前256KB切片的 md5, crc32.

#### 例子:

Expand All @@ -697,13 +701,7 @@ BaiduPCS-Go ep <文件/目录1> <文件/目录2> ...

#### 注意

**无法导出 20GB 以上的文件!!**

**无法导出文件的版本历史等数据!!**

**以通用秒传格式导出会丢失文件路径信息!!**

并不是所有的文件都能导出成功, 程序会列出无法导出的文件列表
**秒传已不被支持, 该功能已无实际作用**

#### 例子:

Expand Down Expand Up @@ -801,7 +799,6 @@ BaiduPCS-Go mv /我的资源/1.mp4 /我的资源/3.mp4
```
# 转存分享链接里的文件到当前目录:
BaiduPCS-Go transfer <分享链接> <提取码>
BaiduPCS-Go transfer <秒传链接>
```

注意: 转存文件保存到当前工作目录下, 不支持指定.
Expand Down
4 changes: 2 additions & 2 deletions baidupcs/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "访问分享页失败"
Expand Down
20 changes: 10 additions & 10 deletions internal/pcscommand/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
}
Expand All @@ -50,15 +50,15 @@ 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())),
"clienttype": "1",
"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"],
Expand All @@ -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",
}
Expand Down
20 changes: 10 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -604,8 +604,8 @@ func main() {
},
},
{
Name: "setastoken",
Usage: "设定当前账号的accessToken",
Name: "setastoken",
Usage: "设定当前账号的accessToken",
Description: `
设定当前登录帐号的accessToken:
若不使用秒传链接转存, 可不设定; accessToken申请及获取教程:
Expand All @@ -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 {
Expand Down Expand Up @@ -1161,7 +1161,7 @@ func main() {
Usage: "将本地文件的修改时间设置为服务器上的修改时间",
},
cli.IntFlag{
Name: "dindex",
Name: "dindex",
Usage: "使用备选下载链接中的第几个,默认第一个",
},
cli.BoolFlag{
Expand Down Expand Up @@ -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)
Expand All @@ -1538,7 +1538,7 @@ func main() {
Value: 0,
},
cli.BoolFlag{
Name: "f",
Name: "f",
Usage: "输出带密码的完整链接格式",
},
},
Expand Down
8 changes: 4 additions & 4 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down

0 comments on commit 2f33da0

Please sign in to comment.