chenyifanthu / thu-cloud-downloader Goto Github PK
View Code? Open in Web Editor NEW清华大学云盘 (Tsinghua Cloud) 批量下载助手,适用于分享的文件 size 过大导致无法直接下载的情况,本脚本添加了更多实用的小功能
Home Page: https://cloud.tsinghua.edu.cn
清华大学云盘 (Tsinghua Cloud) 批量下载助手,适用于分享的文件 size 过大导致无法直接下载的情况,本脚本添加了更多实用的小功能
Home Page: https://cloud.tsinghua.edu.cn
比如我只想下
给定链接(https://cloud.tsinghua.edu.cn/d/674208019e314311ab5c/)
下的chatglm2-6b-int4文件夹内的内容
不支持加密文件的下载,是否有办法添加对有密码分享链接的支持?
THU-Cloud-Downloader/thu_cloud_download.py
Lines 89 to 95 in 8b610c4
When the download_single_file function encounters a URL that points to a non-existent file, it currently does not raise an error and proceeds as if downloading a regular file. As a result, the downloaded file is merely a webpage saying “文件不存在”.
A notable challenge is that the server still responds with a status code of 200 instead of 404 in such case. An ugly-but-effective way solution involves checking for redirection in resp
: an exist file will undergo a redirection from files/?dl=1
to seafhttp/files/
. In contrast, a Not Found response is served directly from files/?dl=1
without any redirection.
def download_single_file(url: str, fname: str, pbar: tqdm):
global sess
resp = sess.get(url, stream=True)
if not resp.history:
raise ValueError("File may non-exist!")
with open(fname, 'wb') as file:
for data in resp.iter_content(chunk_size=1024):
size = file.write(data)
pbar.update(size)
Wonder if there are more elegant solutions...
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.