aliyunpan cli
Project description
aliyunpan
阿里云盘cli
环境要求: python 3.7 通过测试
低版本环境运行报错参考issue9
安装
pip install aliyunpan
克隆项目
git clone https://github.com/wxy1343/aliyunpan --recurse-submodules
获取refresh_token
注意
- web端获取的refresh_token有防盗链检测
- 可以指定账号密码登入
- 可以通过手机端查找日志获取refresh_token
/sdcard/Android/data/com.alicloud.databox/files/logs/trace/userId/yunpan/latest.log
npm install jsdom
配置refresh_token
echo "refresh_token: 'xxxxx'" > ~/.config/aliyunpan.yaml
配置账号(可选)
echo "username: 'xxxxx'" > ~/.config/aliyunpan.yaml
echo "password: 'xxxxx'" >> ~/.config/aliyunpan.yaml
配置aria2(可选)
cat >> ~/.config/aliyunpan.yaml <<EOF
aria2:
'host': 'http://localhost'
'port': 6800
'secret': ''
EOF
功能介绍
| 指令 | 描述 |
|---|---|
| download (d) | 下载文件/文件夹 |
| ls (dir,l,list) | 列目录 |
| mv (move) | 移动文件/文件夹 |
| rm (del,delete) | 删除文件/文件夹 |
| rename (r) | 重命名文件/文件夹 |
| tree (show,t) | 查看文件树 |
| upload (u) | 上传文件/文件夹 |
| share (s) | 分享文件 |
| mkdir (m) | 创建文件夹 |
| cat (c) | 显示文件内容 |
| tui | 文本用户界面 |
| search | 搜索文件/文件夹 |
| sync | 同步文件夹 |
使用指南
- 查看帮助
python main.py -h
查看详情
| 参数 | 描述 |
| -h, --help | 查看帮助 |
| --version | 查看版本 |
| -c, --config-file | 指定配置文件 |
| -t, --refresh-token | 指定REFRESH_TOKEN |
| -u, --username | 指定账号 |
| -p, --password | 指定密码 |
| -d, --depth | 文件递归深度 |
| -T, --timeout | 请求超时时间(秒) |
| -id, --drive-id | 指定drive_id |
| -a, --album | 是否访问相册 |
- 查看指令参数
python main.py COMMAND -h
查看详情
| 指令 | 参数 | 描述 |
| download | -p, --file | 选择文件(多个) |
| download | -s, --share | 指定分享的序列文件 |
| download | -cs, --chunk-size | 分块大小(字节) |
| download | -a, --aria2 | 发送到aria2 |
| ls,search | -l | 查看详情 |
| share | -p, --file | 指定文件(多个) |
| share | -f, --file-id | 指定file_id(多个) |
| share | -t, --expire-sec | 分享过期时间(秒),默认最大14400 |
| share | -l, --share-link | 输出分享链接 |
| share | -d, --download-link | 输出下载链接 |
| share | -s, --save | 保存序列文件到云盘和本地 |
| share | -S, --share-official | 官方分享功能(需要账号支持) |
| upload | -p, --file | 选择文件(多个) |
| upload,sync | -t, --time-out | 分块上传超时时间(秒) |
| upload,sync | -r, --retry | 上传失败重试次数 |
| upload | -f, --force | 强制覆盖文件 |
| upload | -s, --share | 指定分享的序列文件 |
| upload,sync | -cs, --chunk-size | 分块大小(字节) |
| upload | -c | 断点续传 |
| cat | -e, --encoding | 文件编码 |
| sync | --sync-time | 同步间隔时间 |
断点续传
- 将文件分成多块顺序上传
- 文件上传进度保存在当前目录下的tasks.yaml
- 格式
文件sha1: path: 绝对路径 upload_id: 上传id file_id: 文件id chunk_size: 分块大小 part_number: 最后上传的分块编号
- 文件未上传成功时,CTRL+C会自动保存
- 断点续传需带上参数-c
分享
1.分享链接格式
aliyunpan://文件名|sha1|文件大小|相对路径
例如
aliyunpan://示例文件.txt|F61851825609372B3D7F802E600B35A497CFC38E|24|root
2.文件分享
python main.py share 示例文件.txt
导入
python main.py upload "aliyunpan://示例文件.txt|F61851825609372B3D7F802E600B35A497CFC38E|24|root"
3.文件夹分享
python main.py share 示例文件夹
导入
python main.py upload -s "aliyunpan://示例文件夹|80E7E25109D4246653B600FDFEDD8D8B0D97E517|970|root"
TUI按键指南
- 显示菜单(ctrl+x)
- 退出(ctrl+c)
- 切换标签(↑↓←→,kjhl,TAB)
环境变量
ALIYUNPAN_CONF 配置文件路径
ALIYUNPAN_ROOT 根目录(log和tasks输出路径)
致谢
感谢 zhjc1124/aliyundrive 的登录接口参考
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aliyunpan-2.7.7.tar.gz
(190.5 kB
view details)
File details
Details for the file aliyunpan-2.7.7.tar.gz.
File metadata
- Download URL: aliyunpan-2.7.7.tar.gz
- Upload date:
- Size: 190.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e31e7a1244140d5492426c2368399a90e318363c501780807b8c0a69cd3866
|
|
| MD5 |
41482bd692e29a008632765cc0196d87
|
|
| BLAKE2b-256 |
4eacce1d8fa73a79bb2efea60e6d380a13a256c3aecfc435e61b34680a864921
|