Skip to content

Commit

Permalink
v3.9.5
Browse files Browse the repository at this point in the history
- fix #290 , 使用前需设置accessToken, 参见setastoken --help
- 本地文件上传用秒传无须accessToken
- fix #301
- fix #302
  • Loading branch information
qjfoidnh committed Sep 29, 2023
1 parent 81e54b1 commit e239a1e
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 54 deletions.
77 changes: 42 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,19 @@ iikira/BaiduPCS-Go was largely inspired by [GangZhuo/BaiduPCS](https://github.co

[上传](#上传文件目录)本地文件, 支持上传大文件(>2GB), 支持多个文件或目录上传;

[转存](#转存文件目录)其他用户分享的文件, 支持带密码的分享链接;
[转存](#转存文件目录)其他用户分享的文件, 支持带密码的分享链接;

[comment]: <> ([导出]&#40;#导出文件目录&#41;网盘内的文件秒传链接, 可选导出BaiduPCS-Go原生格式或通用格式;)
[导出](#导出文件目录)网盘内的文件秒传链接, 可选导出BaiduPCS-Go原生格式或通用格式;

[离线下载](#离线下载), 支持http/https/ftp/电驴/磁力链协议.

# 版本更新
**2023.09.29** v3.9.5
- 恢复秒传转存功能, 使用前需设置accessToken, 参见setastoken --help
- 本地文件上传用秒传无须accessToken
- fix #301
- fix #302

**2023.09.06** v3.9.5-beta
- 恢复了秒传转存(支持长短链), 感谢油猴脚本开发者tousakarin的贡献
- 新秒传接口需要开发者授权, 稳定性未知, 该测试版本仅供有秒传强需求的用户试用, 请谨慎更新
Expand Down Expand Up @@ -655,71 +661,71 @@ BaiduPCS-Go fixmd5 <文件1> <文件2> <文件3> ...
BaiduPCS-Go fixmd5 /我的资源/1.mp4
```

[comment]: <> (## 获取本地文件的秒传信息)
## 获取本地文件的秒传信息

[comment]: <> (```)
```
[comment]: <> (BaiduPCS-Go sumfile <本地文件的路径>)
BaiduPCS-Go sumfile <本地文件的路径>
[comment]: <> (BaiduPCS-Go sf <本地文件的路径>)
BaiduPCS-Go sf <本地文件的路径>
[comment]: <> (```)
```

[comment]: <> (获取本地文件的大小, md5, 前256KB切片的 md5, crc32, 可用于秒传文件.)
获取本地文件的大小, md5, 前256KB切片的 md5, crc32, 可用于秒传文件.

[comment]: <> (#### 例子:)
#### 例子:

[comment]: <> (```)
```
[comment]: <> (# 获取 C:\Users\Administrator\Desktop\1.mp4 的秒传信息)
# 获取 C:\Users\Administrator\Desktop\1.mp4 的秒传信息
[comment]: <> (BaiduPCS-Go sumfile C:/Users/Administrator/Desktop/1.mp4)
BaiduPCS-Go sumfile C:/Users/Administrator/Desktop/1.mp4
[comment]: <> (```)
```

[comment]: <> (## 导出文件/目录)
## 导出文件/目录

[comment]: <> (```)
```
[comment]: <> (BaiduPCS-Go export <文件/目录1> <文件/目录2> ...)
BaiduPCS-Go export <文件/目录1> <文件/目录2> ...
[comment]: <> (BaiduPCS-Go ep <文件/目录1> <文件/目录2> ...)
BaiduPCS-Go ep <文件/目录1> <文件/目录2> ...
[comment]: <> (```)
```

[comment]: <> (导出网盘内的文件或目录, 原理为秒传文件, 此操作会生成导出文件或目录的命令.)
导出网盘内的文件或目录, 原理为秒传文件, 此操作会生成导出文件或目录的命令.

[comment]: <> (#### 注意)
#### 注意

[comment]: <> (**无法导出 20GB 以上的文件!!**)
**无法导出 20GB 以上的文件!!**

[comment]: <> (**无法导出文件的版本历史等数据!!**)
**无法导出文件的版本历史等数据!!**

[comment]: <> (**以通用秒传格式导出会丢失文件路径信息!!**)
**以通用秒传格式导出会丢失文件路径信息!!**

[comment]: <> (并不是所有的文件都能导出成功, 程序会列出无法导出的文件列表)
并不是所有的文件都能导出成功, 程序会列出无法导出的文件列表

[comment]: <> (#### 例子:)
#### 例子:

[comment]: <> (```)
```
[comment]: <> (# 导出当前工作目录:)
# 导出当前工作目录:
[comment]: <> (BaiduPCS-Go export)
BaiduPCS-Go export
[comment]: <> (# 导出所有文件和目录, 并设置新的根目录为 /root)
# 导出所有文件和目录, 并设置新的根目录为 /root
[comment]: <> (BaiduPCS-Go export -root=/root /)
BaiduPCS-Go export -root=/root /
[comment]: <> (# 导出 /我的资源)
# 导出 /我的资源
[comment]: <> (BaiduPCS-Go export /我的资源)
BaiduPCS-Go export /我的资源
[comment]: <> (# 导出 /我的资源 格式为通用秒传链接格式)
# 导出 /我的资源 格式为通用秒传链接格式
[comment]: <> (BaiduPCS-Go export /我的资源 --link)
BaiduPCS-Go export /我的资源 --link
[comment]: <> (```)
```

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

注意: 转存文件保存到当前工作目录下, 不支持指定.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/oleiade/lane v1.0.1
github.com/olekukonko/tablewriter v0.0.4
github.com/peterh/liner v1.2.1
github.com/qjfoidnh/Baidu-Login v1.4.0
github.com/qjfoidnh/Baidu-Login v1.4.1
github.com/qjfoidnh/baidu-tools v1.2.0 //dfa5778abeed
github.com/tidwall/gjson v1.6.4
github.com/urfave/cli v1.22.5
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down Expand Up @@ -155,12 +154,11 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/qjfoidnh/Baidu-Login v1.4.0 h1:47WKkWgAlDSn5CBbeRfh8FwzFeE6qVnaw7+y2km5h7g=
github.com/qjfoidnh/Baidu-Login v1.4.0/go.mod h1:oRFCmVYQka0KYwvbf2zS6UeMupgv0w1CSq4Jovhz6qg=
github.com/qjfoidnh/Baidu-Login v1.4.1 h1:o9GzvdGx1Z90IbgrgfNTgeTJAaOXOD/GpppdNe4d6Cs=
github.com/qjfoidnh/Baidu-Login v1.4.1/go.mod h1:oRFCmVYQka0KYwvbf2zS6UeMupgv0w1CSq4Jovhz6qg=
github.com/qjfoidnh/BaiduPCS-Go v0.0.0-20201218134534-d55d9918bd1b/go.mod h1:00iH1dQEStMeT3t+oeVrIucWcu3fFEaFYyygNxfOEv4=
github.com/qjfoidnh/baidu-tools v1.2.0 h1:VoXJCN16xzL0xh1BOI2l2p80X5HwKB0PE4SgtX8wn30=
github.com/qjfoidnh/baidu-tools v1.2.0/go.mod h1:TzIKHinLPcQbWxAROpqoSvYxM/kDeswfXJaQ2E1p4zs=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
9 changes: 4 additions & 5 deletions internal/pcsfunctions/pcsupload/upload_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ func (ud *UploadingDatabase) Save() error {

// UpdateUploading 更新正在上传
func (ud *UploadingDatabase) UpdateUploading(meta *checksum.LocalFileMeta, state *uploader.InstanceState) {
ud.lock.RLock()
defer ud.lock.RUnlock()
if meta == nil {
return
}
ud.lock.RLock()
defer ud.lock.RUnlock()
meta.CompleteAbsPath()
for k, uploading := range ud.UploadingList {
if uploading.LocalFileMeta == nil {
Expand All @@ -121,13 +121,12 @@ func (ud *UploadingDatabase) deleteIndex(k int) {

// Delete 删除
func (ud *UploadingDatabase) Delete(meta *checksum.LocalFileMeta) bool {
ud.lock.Lock()
defer ud.lock.Unlock()
if meta == nil {
return false
}

meta.CompleteAbsPath()
ud.lock.Lock()
defer ud.lock.Unlock()
for k, uploading := range ud.UploadingList {
if uploading.LocalFileMeta == nil {
continue
Expand Down
9 changes: 4 additions & 5 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-beta"
Version = "v3.9.5-devel"

historyFilePath = filepath.Join(pcsconfig.GetConfigDir(), "pcs_command_history.txt")
reloadFn = func(c *cli.Context) error {
Expand Down Expand Up @@ -608,10 +608,9 @@ func main() {
Usage: "设定当前账号的accessToken",
Description: `
设定当前登录帐号的accessToken:
若不使用秒传链接转存, 可不设定; accessToken获取网址如下:
https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=L6g70tBRRIXLsY0Z3HwKqlRE&redirect_uri=oob&scope=netdisk
请在浏览器登录当前网盘账户后打开上述链接, 如果出现授权确认界面请确认授权, 然后复制跳转到的页面url, 找到access_token=xxxxxxx&这段, xxxxxxx即为accessToken
注意accessToken的有效期为一个月, 过期后请重复上述步骤更新token
若不使用秒传链接转存, 可不设定; accessToken申请及获取教程:
https://github.com/qjfoidnh/BaiduPCS-Go/wiki/accessToken%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B
注意accessToken的有效期为一个月, 过期后请按教程指导更新token
示例:
BaiduPCS-Go setastoken 156.182v9052tgf1006c89891bsfb2401974.YmKOAwBD9yGaG2s4p5NNkX4CXeIbJxx4hAxotfS.PyuHEs
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": 4,
"Patch": 5,
"Build": 0
},
"ProductVersion": {
"Major": 3,
"Minor": 9,
"Patch": 4,
"Patch": 5,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "qjfoidnh",
"FileDescription": "百度网盘客户端(加强版)",
"FileVersion": "v3.9.4",
"FileVersion": "v3.9.5",
"InternalName": "",
"LegalCopyright": "© 2016-2020 iikira.",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "BaiduPCS-Go",
"ProductVersion": "v3.9.4",
"ProductVersion": "v3.9.5",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit e239a1e

Please sign in to comment.