apachecn / cdndrive Goto Github PK
View Code? Open in Web Editor NEW:cloud: CDNDrive = BiliDrive + SuperBed,支持任意文件的全速上传与下载
Home Page: https://pypi.org/project/CDNDrive/
License: Other
:cloud: CDNDrive = BiliDrive + SuperBed,支持任意文件的全速上传与下载
Home Page: https://pypi.org/project/CDNDrive/
License: Other
下载成功 上传bili 报错http403
按下方向键后出现类似 ^[[A
的字符串,环境为WSL Ubuntu 20.04。已经安装python3-readlike,并且经验证在python3.8默认的交互界面下可以支持方向键。作为对比,直接使用Windows平台下的Python3则可以支持方向键。
已解决
请问有没有支持IPv6的CDN呀?
校园网流量太贵了,ipv6却免费用。
所以想找一个能走ipv6的CDN,或者让程序也支持ipv6?
{
"Version": "13.6.1",
"Name": "飞猫云",
"DestinationType": "ImageUploader",
"RequestMethod": "POST",
"RequestURL": "https://ucgimg.fmapp.com/Public/imgquality/img_up1.php",
"Body": "MultipartFormData",
"FileFormName": "file",
"URL": "https://ucgimg.fmapp.com$json:data$"
}
如题
下载时报错:
[2021-02-26 20:23:16] 分块2564/5530下载完毕
Traceback (most recent call last):
File "d:\anaconda3\envs\web\lib\site-packages\PIL\ImageFile.py", line 247, in load
s = read(self.decodermaxblock)
File "d:\anaconda3\envs\web\lib\site-packages\PIL\PngImagePlugin.py", line 896, in load_read
cid, pos, length = self.png.read()
File "d:\anaconda3\envs\web\lib\site-packages\PIL\PngImagePlugin.py", line 162, in read
length = i32(s)
File "d:\anaconda3\envs\web\lib\site-packages\PIL_binary.py", line 75, in i32be
return unpack_from(">I", c, o)[0]
struct.error: unpack_from requires a buffer of at least 4 bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "d:\anaconda3\envs\web\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "d:\anaconda3\envs\web\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\anaconda3\envs\web\Scripts\cdrive.exe_main.py", line 7, in
File "d:\anaconda3\envs\web\lib\site-packages\CDNDrive_main.py", line 321, in main
args.func(args)
File "d:\anaconda3\envs\web\lib\site-packages\CDNDrive_main_.py", line 226, in download_handle
for h in hdls: h.result()
File "d:\anaconda3\envs\web\lib\concurrent\futures_base.py", line 435, in result
return self.__get_result()
File "d:\anaconda3\envs\web\lib\concurrent\futures_base.py", line 384, in __get_result
raise self.exception
File "d:\anaconda3\envs\web\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "d:\anaconda3\envs\web\lib\site-packages\CDNDrive_main.py", line 179, in tr_download
block = encoder.decode(block)
File "d:\anaconda3\envs\web\lib\site-packages\CDNDrive\encoders\PngEncoder.py", line 72, in decode
return self.decode_png(data)
File "d:\anaconda3\envs\web\lib\site-packages\CDNDrive\encoders\PngEncoder.py", line 62, in decode_png
data = img.tobytes()
File "d:\anaconda3\envs\web\lib\site-packages\PIL\Image.py", line 734, in tobytes
self.load()
File "d:\anaconda3\envs\web\lib\site-packages\PIL\ImageFile.py", line 253, in load
raise OSError("image file is truncated") from e
OSError: image file is truncated
[2021-02-26 20:23:33] 分块2561/5530第1次下载失败
[2021-02-26 20:23:35] 分块2565/5530第1次下载失败
[2021-02-26 20:24:53] 分块3175/5530第1次下载失败
[2021-02-26 20:25:33] 分块3626/5530第1次下载失败
[2021-02-26 20:25:34] 分块3634/5530第1次下载失败
通过cookies正常登陆bili,但是上传文件的时候显示
[2023-11-14 15:08:04] 分块4/5第1次上传失败:HTTP 403
[2023-11-14 15:08:04] 分块1/5第1次上传失败:HTTP 403
[2023-11-14 15:08:04] 分块2/5第1次上传失败:HTTP 403
......
想知道怎么解决该问题,谢谢!
登录显示成功,但下载时出现问题:
比如:网页上链接是:
「帅张和他的朋友们」第二期精华电子书.pdf (1.49 MB) | bdex://0f39451b7944df1e8483897753af1ee443ded38c
到下载时,
cdrive download bdex://0f39451b7944df1e8483897753af1ee443ded38c
[2020-04-10 18:00:34] 下载: 「帅张和他的朋友们」第二期精华电子书.pdf (1.49 MB), 共有1个分块, 上传于2020-01-25 17:18:02
[2020-04-10 18:00:34] 线程数: 8
[2020-04-10 18:00:50] 分块1/1第1次下载失败
[2020-04-10 18:01:32] 分块1/1下载完毕
[2020-04-10 18:01:32] 「帅张和他的朋友们」第二期精华电子书.pdf (1.49 MB) 下载完毕, 用时58.4秒, 平均速度26.15 KB/s
[2020-04-10 18:01:32] 文件校验通过
这个是成功的,然后换一个大一些的文件:
吾爱破解论坛精华集 2019 第四部分.epub (28.50 MB) bdex://25819e6fc4988b119c4b9965af3f325647cb968f
cdrive download bdex://25819e6fc4988b119c4b9965af3f325647cb968f
[2020-04-10 18:04:43] 下载: 吾爱破解论坛精华集 2019 第四部分.epub (28.50 MB), 共有8个分块, 上传于2020-03-28 10:47:11
文件已存在, 是否覆盖? [y/N] y
[2020-04-10 18:04:47] 线程数: 8
[2020-04-10 18:04:56] 分块5/8第1次下载失败
[2020-04-10 18:04:56] 分块6/8第1次下载失败
[2020-04-10 18:04:57] 分块1/8第1次下载失败
[2020-04-10 18:04:58] 分块8/8第1次下载失败
[2020-04-10 18:04:59] 分块3/8第1次下载失败
[2020-04-10 18:05:00] 分块2/8第1次下载失败
[2020-04-10 18:05:04] 分块7/8第1次下载失败
[2020-04-10 18:05:08] 分块8/8第2次下载失败
[2020-04-10 18:05:09] 分块4/8第1次下载失败
[2020-04-10 18:05:09] 分块3/8第2次下载失败
[2020-04-10 18:05:11] 分块1/8第2次下载失败
[2020-04-10 18:05:13] 分块5/8第2次下载失败
[2020-04-10 18:05:14] 分块2/8第2次下载失败
[2020-04-10 18:05:17] 分块6/8第2次下载失败
[2020-04-10 18:05:18] 分块4/8第2次下载失败
[2020-04-10 18:05:18] 分块7/8第2次下载失败
[2020-04-10 18:05:19] 分块8/8第3次下载失败
[2020-04-10 18:05:21] 分块1/8第3次下载失败
[2020-04-10 18:05:24] 分块2/8第3次下载失败
[2020-04-10 18:05:25] 分块5/8第3次下载失败
[2020-04-10 18:05:28] 分块6/8第3次下载失败
[2020-04-10 18:05:32] 分块7/8第3次下载失败
[2020-04-10 18:05:33] 分块2/8第4次下载失败
[2020-04-10 18:05:34] 分块8/8第4次下载失败
[2020-04-10 18:05:35] 分块3/8第3次下载失败
[2020-04-10 18:05:38] 分块4/8第3次下载失败
[2020-04-10 18:05:39] 分块5/8第4次下载失败
[2020-04-10 18:05:43] 分块7/8第4次下载失败
[2020-04-10 18:05:43] 分块8/8下载完毕
[2020-04-10 18:05:50] 分块2/8第5次下载失败
[2020-04-10 18:05:50] 分块4/8第4次下载失败
[2020-04-10 18:05:55] 分块1/8第4次下载失败
[2020-04-10 18:05:56] 分块5/8第5次下载失败
[2020-04-10 18:05:58] 分块6/8第4次下载失败
[2020-04-10 18:06:00] 分块7/8第5次下载失败
[2020-04-10 18:06:01] 分块2/8第6次下载失败
[2020-04-10 18:06:02] 分块4/8第5次下载失败
[2020-04-10 18:06:02] 分块3/8第4次下载失败
[2020-04-10 18:06:06] 分块5/8第6次下载失败
[2020-04-10 18:06:08] 分块1/8第5次下载失败
[2020-04-10 18:06:08] 分块7/8第6次下载失败
[2020-04-10 18:06:12] 分块3/8第5次下载失败
[2020-04-10 18:06:14] 分块2/8第7次下载失败
[2020-04-10 18:06:16] 分块6/8第5次下载失败
[2020-04-10 18:06:16] 分块4/8第6次下载失败
[2020-04-10 18:06:19] 分块7/8第7次下载失败
[2020-04-10 18:06:20] 分块1/8第6次下载失败
[2020-04-10 18:06:22] 分块3/8第6次下载失败
[2020-04-10 18:06:27] 分块4/8第7次下载失败
[2020-04-10 18:06:28] 分块5/8第7次下载失败
[2020-04-10 18:06:29] 分块6/8第6次下载失败
[2020-04-10 18:06:35] 分块5/8第8次下载失败
[2020-04-10 18:06:40] 分块1/8第7次下载失败
[2020-04-10 18:06:40] 分块4/8第8次下载失败
[2020-04-10 18:06:45] 分块6/8第7次下载失败
[2020-04-10 18:06:49] 分块1/8第8次下载失败
[2020-04-10 18:06:50] 分块5/8第9次下载失败
[2020-04-10 18:06:51] 分块3/8第7次下载失败
[2020-04-10 18:06:52] 分块4/8第9次下载失败
[2020-04-10 18:06:57] 分块6/8第8次下载失败
[2020-04-10 18:07:05] 分块1/8第9次下载失败
[2020-04-10 18:07:05] 分块3/8第8次下载失败
[2020-04-10 18:07:06] 分块2/8第8次下载失败
[2020-04-10 18:07:06] 分块5/8第10次下载失败
[2020-04-10 18:07:07] 分块6/8第9次下载失败
[2020-04-10 18:07:16] 分块1/8第10次下载失败
[2020-04-10 18:07:18] 分块3/8第9次下载失败
[2020-04-10 18:07:22] 分块4/8第10次下载失败
[2020-04-10 18:08:04] 分块2/8第9次下载失败
[2020-04-10 18:08:05] 分块7/8下载完毕
随后就退出,没有下载成功,这是怎么回事啊?
在本地读取文件树结构,并且设计一种储存格式,在分别上传文件夹内文件的时候将文件和对应的url对应起来,之后作为一个总index上传至图床作为文件夹url。
只是个人建议的思路,这个功能有个还是很不错的
我有批量下载大量小文件的需求,最多的情况下有接近100000个,我以一行一个的格式把meta链接存储在一个list文件中。我尝试用脚本并发多线程循环遍历下载,但随着并发数的增加,python崩溃的机率也增加了,这导致最后会漏掉不少文件(5%~10%),而且CPU开销也很大。我本人不太懂python,所以也不知道该怎么改。
从我查资料的情况来看,异步多线程无阻塞的实现方式是效率最高的。我建议为该项目添加-l (list)和-j (jobs)参数,前者表示从列表文件中读取meta链接,后者表示最大并发数。
Version: PIP newest
G:\>cdrive login bili ** ***
[2021-05-31 19:57:10] 用户信息获取失败
G:\>cdrive cookies bili d:\cookies.txt
[2021-05-31 19:57:18] 用户信息获取失败
Version: mater
latest
G:\>cdrive login bili *** ***
[2021-05-31 19:58:24] 登录失败:服务繁忙, 请稍后再试
G:\>cdrive cookies bili "d:\cookies.txt"
[2021-05-31 19:58:32] 用户信息获取失败
See also: #19
[root@linode ~]$ cdrive -h
usage: CDNDrive [-h] [-v]
{login,cookies,userinfo,upload,download,info,history} ...
Make Picbeds Great Cloud Storages!
positional arguments:
{login,cookies,userinfo,upload,download,info,history}
login log in to the site
cookies set cookies to the site
userinfo get userinfo
upload upload a file
download download a file
info show meta info
history show upload history
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
[root@linode ~]$ cdrive login -h
usage: CDNDrive login [-h]
{***DELETED CONTENT***}
username password
positional arguments:
{***DELETED CONTENT***}
site
username username
password password
optional arguments:
-h, --help show this help message and exit
不是说了 -h
可以看支持的站点吗 QwQ
pip install CDNDrive
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement CDNDrive (from versions: none)
ERROR: No matching distribution found for CDNDrive
如题,怎么运行CDNDrive> 都不会出现
怎么获取?
CSDN cookie项很多啊
[root@linode bilibili_椎名菜羽-ShiinaNanoha_22347054]# cdrive upload ali 【B限】钢琴弾唱♪_20200830200230754.flv
[2020-08-30 23:49:38] 上传: 【B限】钢琴弾唱♪_20200830200230754.flv (1.70 GB)
Traceback (most recent call last):
File "/usr/local/bin/cdrive", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/CDNDrive/__main__.py", line 321, in main
args.func(args)
File "/usr/local/lib/python3.6/site-packages/CDNDrive/__main__.py", line 120, in upload_handle
history = read_history(args.site)
File "/usr/local/lib/python3.6/site-packages/CDNDrive/util.py", line 64, in read_history
history = json.loads(f.read())
File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[root@linode bilibili_椎名菜羽-ShiinaNanoha_22347054]#
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaf in position 0: invalid start byte
OS:linux
当用户有多个文件需要上传时,如果一个一个上传,是一个十分费力不讨好的事情。
采用对文件夹进行递归搜索,自动上传
.
├── 3006101
│ ├── 【肯尼亞-NR】炸鸡:女大学生最爱的安娜-092526-752.flv
│ └── 【肯尼亞-NR】炸鸡:女大学生最爱的安娜-092706-288.flv
├── 5655865
│ └── 【木之本切】我是猪-023439-113.flv
├── config.backup.json
└── config.json
对于所选定的文件夹进行全部深程递归,依次自动上传,并将每个文件对目标文件夹的相对路径做记录,与上传的分享链接组成key - value
在将整个字典进行base64的编码(过长的话可以考虑压缩)分享,类似于vemss/vless的分享链接
对目标文件夹进行tar gz 类型的压缩,然后整体上传,这样的缺点很明显,太占用系统的存储空间了。优点则是简单易懂,多平台兼容
大文件上传内存全部吃完了,估计是没有释放内存导致的
我试着用pyinstaller打包了一下,但是没有成功,希望作者能打包一下
cdrive download 之后 提示下载成功,可是资源在哪里啊? 抱歉!我不懂python。。。希望能告知一下,万分感谢!
想作为图床,上传一张png后缀的图片,直链访问却是一堆像素点.....
现在站点有了哔哩哔哩之外的,但是都提示不支持账号密码登录,要用cookie,所以该怎么使用
之前一直没问题的,最近一两周出现的问题,上传的时候没问题,但是下载失败:
cdrive download bdex://5787c80246b33*****************
Traceback (most recent call last):
File "E:\Programs\Python\Python310\lib\runpy.py", line 196, in run_module_as_main
return run_code(code, main_globals, None,
File "E:\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "E:\Programs\Python\Python310\Scripts\cdrive.exe_main.py", line 7, in
File "E:\Programs\Python\Python310\lib\site-packages\CDNDrive_main.py", line 329, in main
args.func(args)
File "E:\Programs\Python\Python310\lib\site-packages\CDNDrive_main.py", line 203, in download_handle
meta_dict = fetch_meta(args.meta)
File "E:\Programs\Python\Python310\lib\site-packages\CDNDrive_main_.py", line 50, in fetch_meta
meta_dict = json.loads(encoder.decode(full_meta).decode("utf-8"))
File "E:\Programs\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "E:\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "E:\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
用的是Windows系统,同时上传的baijia和微博都没问题,可以下载下来
登录失败:Expecting value: line 1 column 1 (char 0)
如果你是pip安装: pip install CDNDrive
运行 cdrive 报错
$ cdrive
-bash: cdrive: command not found
根据报错,说明:环境变量没配置
sudo find / -name cdrive
路径: ~/Library/Python/3.8/bin/cdrive
vim ~/.bash_profile
export PATH=$PATH:~/Library/Python/3.8/bin
source ~/.bash_profile
cdrive
usage: CDNDrive [-h] [-v] {login,cookies,userinfo,upload,download,info,history,help,version,exit} ...
Make Picbeds Great Cloud Storages!
positional arguments:
{login,cookies,userinfo,upload,download,info,history,help,version,exit}
login log in to the site
cookies set cookies to the site
userinfo get userinfo
upload upload a file
download download a file
info show meta info
history show upload history
help show this help message
version show program's version number
exit exit program
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
CDNDrive >
ubuntu@ubuntu:~$ cdrive login bili xxxxxx xxxxxxx
[2022-01-22 18:48:40] 登录失败:服务繁忙, 请稍后再试
ps:网页登录bilibili好像需要点击图片验证的
分块比较多的情况下,个别分块第1次下载失败,往往是因为分块损害或被删除,但其他分块下载还在继续,导致最后文件其他分块全下好后,个别分块下载失败,文件本身因为分块缺失是损坏的........浪费了时间........
使用 pip 安装CDNDrive,python 版本:3.8.5
使用用户名和密码登录:
[2021-02-24 17:13:26] 登录失败:服务繁忙, 请稍后再试
使用34位SESSDATA参数登录:
[2021-02-24 17:13:33] 用户信息获取失败
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.