deepjyoti30 / downloader-cli Goto Github PK
View Code? Open in Web Editor NEWA simple downloader written in Python with an awesome customizable progressbar.
License: MIT License
A simple downloader written in Python with an awesome customizable progressbar.
License: MIT License
Hey, I've noticed that I often get a divide by zero error when trying to download files.
It appears the code does not handle the case when cur_time - beg_time
is 0
Traceback (most recent call last):
File "downloader-cli\0.3.1\downloader_cli\download.py", line 376, in _download
speed, s_unit, time_left, time_unit = self._get_speed_n_time(
File "downloader-cli\0.3.1\downloader_cli\download.py", line 264, in _get_speed_n_time
speed = (file_size_dl / 1024) / (cur_time - beg_time)
ZeroDivisionError: float division by zero
If I try to download a picture from instagram I get errno 22.
For example if I try to download the picture from this url:
I get following error:
ERROR: [Errno 22] Invalid argument: '138734412_2824463591207841_3866668501561580560_n.jpg?_nc_ht=scontent-muc2-1.cdninstagram.com&_nc_cat=109&_nc_ohc=KyByhjfBR1cAX9pp60k&tp=1&oh=c6072950e86196c504ac446f885378f3&oe=6037334E'
I think it tries to get the filename and splits the url wrong?
UPDATE: Only happens on Python3 installed on Windows 10. On my linux machine it runs without an error.
Seems to download unnecessary data onto already completed files instead of skipping it. The file size just ends up larger than the original size. So maybe add a condition for cur_size >= int(original_size)
or something
downloader-cli/downloader_cli/download.py
Lines 118 to 123 in dd0b8c6
I don't know much more about it than the person on reddit knew, but I thought I'd document this here. Some download requests don't get Content-Length
, causing a TypeError exception on line 76. I was able to reproduce this by attempting to download download.py
directly from this repo (via the raw content link.)
Now that GitHub Actions are free, depending on the storage situation, it might be possible to run pytest on push/PR. Also to have it try each invocation in succession, against a checksum (download, check integrity, delete, download, interrupt, resume, check integrity...)
Display is very cool, but having an alias/copying download.py
to whatever directory you want to use it it in is fiddly, especially in big projects.
It would be easier if this was installed using setuptools, which would automatically install urllib3
, and create the dw
console script regardless of OS. (so no need to create the alias)
If it was installed into the global python packages, one could use it anywhere, by doing something like
pip3 install --user git+https://github.com/deepjyoti30/downloader-cli
and then importing it like any other package you'd install with pip.
If this seems like something you'd want to do, I can create a PR.
The downloader in a specific machine writes 8192 bytes to a file and an exception occurs with this message: ERROR: [Errno 25] Inappropriate ioctl for device
Any ideas?
It would be very useful to be able to pass a file with urls to this and have it go through and download them.
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.