2核1G3M服务器88一季度

腾讯云,阿里云百度云等 折扣价→点我←

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

爱拷贝 二级用户组

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

截图

安装

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

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

方法一:直接访问地址

https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=ea2b36f6-b8ad-40be-bc0f-e5e4a4a7d4fa&redirect_uri=https://api.moeclub.org/onedrive-login

然后登录你的账号获取auth_token即可。

方法二:先使用浏览器访问该地址→ https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=ea2b36f6-b8ad-40be-bc0f-e5e4a4a7d4fa&redirect_uri=http://localhost/onedrive-login

登录你的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+x、y保存退出。

开始运行:

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.moerats.com/usr/shell/Caddy/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

配置Caddy:

以下全部内容是一个整体,请修改域名后一起复制到SSH运行!

echo "www.moerats.com {

gzip

tls admin@moerats.com

proxy / 127.0.0.1:8888

}" > /usr/local/caddy/Caddyfile

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

启动Caddy:

/etc/init.d/caddy start

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

最后如果你没有OneDrive大容量网盘可以申请1年开发者计划,申请地址→https://www.aikaobei.com/index.php/archives/432/

标签: none

非特殊说明,本博所有文章均为博主原创。

如若转载,请注明出处:https://www.aikaobei.com/index.php/archives/430/


TAGS 源码

站长窝论坛版权声明 1、本帖标题:一个可以解决因api抽风出现空目录的OneDrive目录程序:OneList
2、论坛网址:站长窝论坛
3、站长窝论坛的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
4、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
5、站长窝论坛一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6、本帖由爱拷贝在站长窝论坛《程序综合区》版块原创发布, 转载请注明出处!
评论
最新回复 (0)
返回
发新帖