-
-
Save Yegorov/dc61c42aa4e89e139cd8248f59af6b3e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# https://toster.ru/q/72866 | |
# How to | |
# wget http://gist.github.com/... | |
# chmod +x ya.py | |
# ./ya.py download_url path/to/directory | |
import os, sys, json | |
import urllib.parse as ul | |
sys.argv.append('.') if len(sys.argv) == 2 else None | |
base_url = 'https://cloud-api.yandex.net:443/v1/disk/public/resources/download?public_key=' | |
url = ul.quote_plus(sys.argv[1]) | |
folder = sys.argv[2] | |
res = os.popen('wget -qO - {}{}'.format(base_url, url)).read() | |
json_res = json.loads(res) | |
filename = ul.parse_qs(ul.urlparse(json_res['href']).query)['filename'][0] | |
os.system("wget '{}' -P '{}' -O '{}'".format(json_res['href'], folder, filename)) | |
# os.system("wget '{}'".format(json_res['href'])) |
is it possible to add recursive downloading?
im trying to download and get this:
HTTP request sent, awaiting response... 507 Insufficient Storage
2019-01-02 16:32:18 ERROR 507: Insufficient Storage.
it looks like it asks to townload zip file.
Thanks for this script! It works for me while this one is not working https://github.com/Yegorov/yadisk
See my addition for large files download that's prone to long connection errors https://gist.github.com/wildcard/8c1cb5ac0bb5713a17ef1e4dd6e4780b#gistcomment-3909074
Thanks for the script.
Link Node.js fork: https://gist.github.com/wcoder/bb62eac43a63bcc49847665f59697306
is it possible to add recursive downloading? im trying to download and get this:
HTTP request sent, awaiting response... 507 Insufficient Storage 2019-01-02 16:32:18 ERROR 507: Insufficient Storage.
it looks like it asks to townload zip file.
+1 it download zip first . yandex can not make super big zip
can you implant it with "axel" module?
it is a basic file downloader with threading support (IDK if yandex allows threading or not)
usage:
axel -a -n [threads_number] [link]
How use