bpcs uploader.php,【重新排版】OOTT123大大的BPCS_Uploader的AMH面板完全使用教程

本帖最后由 894849635 于 2013-8-30 12:25 编辑

之前在咱们论坛看到了消息,便想着试试,不过之前一直失败,如今成功了,便向把具体过程写出来。感谢OOTT123大大的帮忙。

---------------------------------------------------------------------------------------------------------------------------------------------------------

脚本下载地址: 脚本.zip| Github-zip| Github-tar.gz 【均可用wget】

---------------------------------------上面是脚本地址-------------

接下来具体讲解使用教程

1.上传或使用wget将文件上传到服务器,然后再解压,进入文件夹。

2.使用

chmod +x bpcs_uploader.php修改bpcs_uploade.php权限。

3.因为我们使用的AMH面板php是集成的,并不是自己安装的,所以,使用教程中的命令根本执行不下去,所以,我在询问了原作者之后,选择了如下的方法:

在ssh中执行

export PATH=/usr/local/php/bin:$PATH来添加执行PHP的变量这样就可以正常使用命令了

4.输入

php ./bpcs_uploader.php quickinit来快速初始化

敲下命令直接进入快速初始化流程,输入y,然后打开浏览器访问 https://openapi.baidu.com/device ,在“请输入设备上显示的用户授权码:”文本框中输入上面显示的授权码(这里是12abcxyz),并点击继续。 看到网页上显示“请返回设备继续操作!”后,返回ssh上按下回车后,即完成了初始化配置。

5.

php ./bpcs_uploader.php init敲下命令之后会进入初始化流程,这里分段详述设置方法。

Now start the initiation. If you have configured the uploader , it will be overwirte.

Continue? [y/N] y

确认初始化。如果之前有初始化过,那么以前的配置将会被覆盖。

Now you have to enter your baidu PSC app key . You should know that it needs a manual acting.

You can request for it via http://developer.baidu.com/dev#/create .

Make sure you have the PCS app key . if you haven't , you can use the demo key by just hit Enter. So if you dont have the app secret , you have to re-init every month , for the access-token will expires every month.

App KEY [uFBSHEwWE6DD94SQx9z77vgG] :

第一步,输入App key。这里需要输入一个有PCS权限的API KEY,如果没有的话直接敲回车就好了,这里会默认使用内置的一组app key,app secret和app foloder name,所以只要敲下回车就能直接跳到第四步。如果你没有App secret(例如使用L6g70tBRRIXLsY0Z3HwKqlRE这个Key时),只能获取一个有效期为一个月的access token。如果有一个有PSC权限的API KEY和secret,那么就能获得一个有效期为10年的refresh token,以便长期使用。

App key has been setted to uFBSHEwWE6DD94SQx9z77vgG .

Now you have to enter your baidu PSC app secret. If you dont know the secret , keep it blank.

App SECRET [] :

第二步,输入App secret。如果输入了app secret,将会转到device code模式验证;或者直接输入回车使用oob模式验证。先直接回车:

Now you have to enter your app name. You can enter it later in the file [ /root/_bpcs_files_/config/appname ].

[*]Why i have to enter app name ? see FAQs.

If your app name have Chinese characters , please swith your client to the UTF-8 mode.

Here are some chinese characters . Before you enter chinese characters , make sure you can read these characters.

这里是一些中文字符。

If you cant read any chinese above , please press enter , and change it manually in the file [ /root/_bpcs_files_/config/appname ] .

If you have Enter the key L6g70tBRRIXLsY0Z3HwKqlRE , just press Enter.

App Name [pcstest_oauth] :

第三步,这里需要输入app floder name,也就是你申请API时填写的文件夹名字。详情见FAQ 2。因为是使用的默认的key,所以直接回车即可。

Now you have to get your oauth access_token by your own .

Here is a reference document .

http://developer.baidu.com/wiki/index.php?title=docs/pcs/guide/usage_example

A simple guide :

1.visit https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=L6g70tBRRIXLsY0Z3HwKqlRE&redirect_uri=oob&scope=netdisk

in your broswer.

2.when it redirected to a html page , copy the url to the notepad.

3.get the access_token from it , paste it and press Enter.

access_token[] :

第四步,获取access token。在浏览器中打开上述URL( https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=L6g70tBRRIXLsY0Z3HwKqlRE&redirect_uri=oob&scope=netdisk ),进行授权。

授权完毕后,将会跳到一个写着“百度 Oauth2.0”的页面。复制出其中的网页URL,找到access_token=和&之间的字符串,例如:3.**05c2ea85d52c2***************a5.2592000.136***9032.3089166538-23**47

将其复制到shell中粘贴并回车。使用这种方式初始化的用户,需要每月重新初始化。 【一个月一次……头疼】

如果第三步输入app secret的时候没有留空,将会得到下面的消息:

Now open your broswer and visit https://openapi.baidu.com/device .

Copy or input 12abcxyz when it been asks.

After granted the access to the application , be back and press Enter key .

来到这里,打开浏览器访问 https://openapi.baidu.com/device ,在“请输入设备上显示的用户授权码:”文本框中输入上面显示的授权码(这里是12abcxyz),并点击继续。 看到网页上显示“请返回设备继续操作!”后,返回ssh上按下回车后,即可继续。

curl -X GET -k -L "...."

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

0 62 0 62 0 0 40 0 --:--:-- 0:00:01 --:--:-- 235

Success . Your Storage Status : 0.06G/115.00G (0.05%)

Have fun !

你所看到的输出可能和这里给出的不一样,但是只要看到了存储空间的剩余量,和【Have fun !】提示,即说明成功初始化。

查询容量(配额)

php ./bpcs_uploader.php quota结果:

Your Storage Status : 0.06G/115.00G (0.05%)

上传文件

php ./bpcs_uploader.php upload [path_local] [path_remote]路径格式:foo/bar/file.ext(路径中一定要包括文件名)

上传后,能在百度网盘/我的应用数据/应用名/foo/bar下找到一个叫file.ext的文件。

下载文件

php ./bpcs_uploader.php download [path_local] [path_remote] 删除文件

php ./bpcs_uploader.php delete [path_remote]离线下载

php ./bpcs_uploader.php fetch [path_remote] [path_to_fetch]注:离线下载已经可以正常使用。

本文大量借助了oott123的教程,非AMH用户可以参考使用。多谢OOTT123的指点

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值