nPlayer可以直接添加谷歌网盘在线串流播放,但是需要科学上网,本教程通过rclone将Google drive挂载在谷歌云服务器,然后用Caddy的browse插件发布成文件列表,然后就可用nPlayer自带浏览器实现免科学上网在线播放。

You can add google drive directly into nplayer, which is sometime inconvenient. So the alternative plan is to use browser inside nplayer to stream, while webpages come from Caddy and rclone.

目录 / LIST


# 安装Rclone | Install Rclone

  • 首先直接输入官方安装命令一键安装Rclone:
  • To install rclone on Linux/macOS/BSD systems, run:
curl https://rclone.org/install.sh | sudo bash
  • 另外还需要安装fuse用来挂载目录,否者会提示executable file not found
  • In order to avoid error executable file not found, install fuse btw.
# Debian/Ubuntu
apt-get install fuse
# CentOS
yum install fuse

你可能会感兴趣 | Maybe interested in

x


# 配置Rclone | Rclone config

  • 输入rclone config开始初始化配置。
  • Type rclone config to initiate rclone configeration.
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n  #新建 | new remote
name> gdrive  #配置名称 | new name
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
...
12 / Google Drive
   \ "drive"
...
Storage> 12  #选择12 Google Drive | choose 12 
Google Application Client Id - leave blank normally.
client_id>  #留空 | leave blank
Google Application Client Secret - leave blank normally.
client_secret>  #留空 | leave blank
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
service_account_file>  #留空 | leave blank
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
scope> 1 #选择1 读写权限 | choose 1 full access
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders. (see docs).
Enter a string value. Press Enter for the default ("").
root_folder_id>  #留空 | leave blank
Service Account Credentials JSON file path 
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>  #留空 | leave blank
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n  #输入n | chooose n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n  #输入n | chooose n
If your browser does not open automatically go to the following link: https://accounts.google.com/o/...  #复制该地址登陆谷歌网盘授权 | copy url, login google drive and auth
Log in and authorize rclone for access
Enter verification code>******  #输入获取到的code | paste auth code
Configure this as a team drive?
y) Yes
n) No
y/n> n  #输入n | chooose n
--------------------
[Rats]
type = drive
client_id = ******
client_secret = ******
scope = drive
token = {"access_token":"******"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y  #输入y | choose y
Current remotes:

Name                 Type
====                 ====
gdrive               drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q  #输入q保存退出 | choose q to exit

# 挂载Gdrive | Mount Gdrive

  • 首先登陆Filebrowser,选择一个挂载点,新建一个空目录例如home/gdrive.
  • Login filebrowser firstly, make an empty folder to mount, eg. home/gdrive.

你可能会感兴趣 | Maybe interested in

x

  • 输入如下指令将gdrive挂载到本地目录home/gdrive.
  • Type in the following command to mount gdrive to the local folder home/gdrive.
rclone mount gdrive: /home/gdrive --daemon
  • 挂载完毕后即可在后台运行,输入df -h检查一下,注意最底下显示gdrive表示挂载成功。
  • After the mount is complete, you can run it in the background. Enter df -h to check it. Note that gdrive is displayed at the bottom to indicate that mount is successful.
[email protected]:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            281M     0  281M   0% /dev
tmpfs            59M  7.7M   51M  14% /run
/dev/sda1        20G  2.8G   16G  15% /
tmpfs           293M     0  293M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           293M     0  293M   0% /sys/fs/cgroup
gdrive          1.0P  1.4T  1.0P   1% /home/gdrive

# 配置Caddy | Caddy config

  • 接下来修改caddyfile配置文件,把刚才挂载的目录发布成网页。
  • Next, modify the caddyfile and publish the directory you just mounted as a web page.

你可能会感兴趣 | Maybe interested in

x

  • 需要用到browse指令。
  • browse is used.
指令Directives 说明Description
browse 在指定的基本路径内进行目录浏览 enables directory browsing
  • 在Caddyfile中添加如下配置,域名或端口均可。
  • Add the following config in caddyfile, using domain name or port.
http://drive.marsgrid.com {
 root /home/gdrive
 browse
}

或 | or

:3092 {
 root /home/gdrive
 browse
}
  • 注意不要gzip压缩,不要tls加密,在线看视频不需要这些影响速度,同时引起发热的步骤,简单点挺好。
  • Be careful not use gzip to compress, and don't use tls to encrypt in order to make it simlple while streaming.

# 在线播放 | Stream online

  • 打开nPlayer内置的浏览器输入刚才配置的域名或者IP+端口号即可完成在线播放。
  • Open nPlayer's built-in browser and enter the domain name or IP+ port number you just configured to complete streaming.
x

# 参考指南 | User Guide

  • Rclone常用命令参考。
  • Useful rclone commands.
rclone config - 以控制会话的形式添加rclone的配置,配置保存在.rclone.conf文件中。
rclone copy - 将文件从源复制到目的地址,跳过已复制完成的。
rclone sync - 将源数据同步到目的地址,只更新目的地址的数据。
rclone move - 将源数据移动到目的地址。
rclone delete - 删除指定路径下的文件内容。
rclone purge - 清空指定路径下所有文件数据。
rclone mkdir - 创建一个新目录。
rclone rmdir - 删除空目录。
rclone check - 检查源和目的地址数据是否匹配。
rclone ls - 列出指定路径下所有的文件以及文件大小和路径。
rclone lsd - 列出指定路径下所有的目录/容器/桶。
rclone lsl - 列出指定路径下所有文件以及修改时间、文件大小和路径。
rclone md5sum - 为指定路径下的所有文件产生一个md5sum文件。
rclone sha1sum - 为指定路径下的所有文件产生一个sha1sum文件。
rclone size - 获取指定路径下,文件内容的总大小。.
rclone version - 查看当前版本。
rclone cleanup - 清空remote。
rclone dedupe - 交互式查找重复文件,进行删除/重命名操作。
  • 如果你想了解更多Rclone的使用方法,可以访问下方的官方指南。
  • If you want to learn more about how to use rclone, you can visit the official guide below.

Rclone docs:https://rclone.org/docs/

 
• 本文作者 | Author info >> 冰川大魔王
• 来源链接 | Source link >> Rclone+Caddy直连谷歌网盘在线播放 | Streaming via web pages
• 发表评论 | Make comments >>