一个可以解决因api抽风出现空目录的OneDrive目录程序:OneList

说明:目前OneDrive目录程序已经很多了,比如:PyOne、OneIndex和OLAINDEX。这几个各有特色,都挺好用的,不过有时候api在高峰期抽风的时候,都很容易出现空目录的情况,导致下载会出现问题,这里萌咖和sxyazi大佬就历时N天,写了个基于Python3的简约OneDrive目录列表,同时换了一种api来防止因使用人过多导致抽风等问题,稳定性大大的增加,而且使用Redis动态缓存策略,打开目录的速度是相当的快,不过该程序初衷只想安静的做个目录程序,所以是不会增加看视频的功能,如果你想看视频,那就选择开头的3个程序。

截图

一个可以解决因api抽风出现空目录的OneDrive目录程序:OneList

安装

Github地址:https://github.com/0oVicero0/OneList/

说明:该程序不适用OneDrive个人版,且建议使用Debian系统安装,会很快。

1、安装依赖
CenOS 6系统:

#安装EPEL
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
#安装Python3和Redis
yum install python34 redis git -y
#安装pip3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
#启动Redis
service redis start
#设置Redis开机自启
chkconfig redis on

CenOS 7系统:

#安装EPEL
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#安装Python3和Redis
yum install python36 redis git -y
#配置Python3软链接
ln -s /usr/bin/python3.6 /usr/bin/python3
#安装pip3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
#启动Redis
systemctl start redis
#设置Redis开机自启
systemctl enable redis

Debian/Ubuntu系统:

#安装pip3和Redis
apt update
apt install python3-pip redis-server git -y

2、安装OneList

#拉取源码
git clone https://github.com/0oVicero0/OneList.git
#安装依赖
cd OneList && pip3 install -r requirements.txt

3、获取auth_token

提示:获取方式建议选择方法一。

方法一:直接访问地址→传送门,然后登录你的账号获取auth_token即可。

方法二:先使用浏览器访问该地址→传送门,登录你的OneDrive账号,复制地址栏code=&session之间的参数。

获取refresh_token,在SSH客户端使用命令:

#将下面auth_token替换成你获取到的参数,再使用命令
code="auth_token"
wget --no-check-certificate --post-data="client_id=ea2b36f6-b8ad-40be-bc0f-e5e4a4a7d4fa&client_secret=h27zG8pr8BNsLU0JbBh5AOznNS5Of5Y540l/koc7048=&grant_type=authorization_code&resource=https://api.office.com/discovery/&redirect_uri=http://localhost/onedrive-login&code=$code" 'https://login.microsoftonline.com/common/oauth2/token' -qO-

然后复制refresh_token参数后面的字段。

4、运行
接下来在OneList目录新建config.json配置文件。

nano config.json

将以下内容复制进去:

#将下面refresh_token替换成你获取到的字段
{
  "token": "<refresh_token>",
  "location_path": "/",
  "start_directory": "/",
  "threads": 3,
  "diff_seconds": 480,
  "refresh_seconds": 720,
  "metadata_cached_seconds": 768,
  "structure_cached_seconds": 840
}

再使用ctrl+xy保存退出。

开始运行:

gunicorn app:app -b 127.0.0.1:8888 -D

此时访问地址为127.0.0.1:8888,还需要使用域名反代才能访问,如果你要使用ip访问,将运行命令改成0.0.0.0:8888即可。

5、域名反代
安装Caddy

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh
#备用地址
wget -N --no-check-certificate https://www.southcat.net/usr/shell/Caddy/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

配置Caddy

#以下全部内容是一个整体,请修改域名后一起复制到SSH运行!
echo "www.southcat.net {
 gzip
 tls admin@southcat.net
 proxy / 127.0.0.1:8888
}" > /usr/local/caddy/Caddyfile

该配置会自动签发SSL,请提前解析域名到VPS服务器。

启动Caddy

/etc/init.d/caddy start

就可以打开域名进行访问了。



给TA打赏
共{{data.count}}人
人已打赏
cj

一个基于Go的Telegram RSS Bot机器人,支持应用内阅读预览

2020-2-25 11:59:01

cj

Gdrive:Linux下谷歌网盘同步工具、自动备份VPS文件到Google Drive

2020-2-25 16:20:15

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索