本地挂载阿里云盘,观看4K视频
一直使用阿里云盘客户端看视频。最近保存了不少4K片源,但客户端最高只支持1080P(还必须是氪金VIP)。记得云盘支持WebDAV的,应该可以挂载为本地磁盘,用本地播放器观看。
立马行动寻找,找到两个工具:
- aliyundrive-webdav (阿里云盘 WebDAV 服务)
- aliyundrive-fuse(阿里云盘 FUSE 磁盘挂载工具)
前者webdav支持多系统,linux、mac、windows均支持,但需要配合支持wabdav的播放器,或通过rclone工具挂载成本地磁盘,略微繁琐。
后者fuse支持linux和mac,不支持windows,可以直接挂载成本地磁盘操作,但只支持读取,不支持写入。
因为主要在mac下使用看视频,果断选择fuse。
安装
安装十分简单,打开 terminal
,输入 pip3 install aliyundrive-fuse
,即完成安装。但前提是安装了 macFUSE
。
有brew的可直接执行 brew install --cask macfuse
进行安装。其他安装方式可参考:https://osxfuse.github.io/

运行
aliyundrive-fuse运行同样简单:
# 创建目录用于保存阿里云盘的refresh token
mkdir ~/.aliyundrive-fuse
# 创建目录用于挂载阿里云盘
mkdir ~/aliyundrive
# 启动阿里云盘挂载
aliyundrive-fuse -r xxx -S -w ~/.aliyundrive-fuse ~/aliyundrive
2023-01-17T13:38:47.296972Z INFO aliyundrive_fuse::drive: refresh token succeed refresh_token=xxx nick_name=xxx
2023-01-17T13:38:47.297254Z INFO aliyundrive_fuse::drive: found default drive drive_id=235294562
如何获取refresh_token,参见:https://github.com/messense/aliyundrive-webdav#获取-refresh_token
大功告成,可看到阿里云盘已经挂载成为磁盘,可直接打开任何客户端播放。

注意事项
- 运行aliyundrive-fuse后,阿里云盘磁盘为弹出前,terminal不能关闭,也不要退出程序,否则就没法再挂载在同一个目录下(报错见下),只能重新创建一个挂载目录。
mount_macfuse: mount point ~/aliyundrive is itself on a macFUSE volume
Error: No such file or directory (os error 2)
- 在finder里,千万不要显示为图标,选择显示为列表较好,因为图标会预览文件内容,文件很大时,会下载文件,finder会卡住。
- 实测用VLC播放最流畅,且拉滑动条反应最迅速。
命令行用法
USAGE:
aliyundrive-fuse [OPTIONS] --refresh-token <REFRESH_TOKEN> <PATH>
ARGS:
<PATH> Mount point
OPTIONS:
--allow-other Allow other users to access the drive
--domain-id <DOMAIN_ID> Aliyun PDS domain id
-h, --help Print help information
-r, --refresh-token <REFRESH_TOKEN> Aliyun drive refresh token [env: REFRESH_TOKEN=]
-S, --read-buffer-size <READ_BUFFER_SIZE> Read/download buffer size in bytes, defaults to 10MB [default: 10485760]
-V, --version Print version information
-w, --workdir <WORKDIR> Working directory, refresh_token will be stored in there if specified