mjishnu / pypdl

A concurrent pure python downloader with resume capablities
https://pypi.org/project/pypdl/
MIT License
37 stars 8 forks source link

Download stuck at 99% #20

Closed Toylerrr closed 1 month ago

Toylerrr commented 1 month ago

I'm trying to use this package to download a files from a Gamevault server. This is the API endpoint that I am using. The auth seems to work and it will download the file segments but once it hits 99% it halts and just sits there.

from pypdl import *
from aiohttp import BasicAuth
import logging

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger()

def main():
    # Using Basic Authentication
    username = "test"
    password = "asdfghjkl"
    headers = {"User-Agent":"My cool Program/0.1"}
    auth = BasicAuth(username, password)
    print(f"Auth object: {auth}")
    dl = Pypdl(auth=auth, headers=headers)
    # Start the download
    dl.start(url='http://192.168.0.200:5006/api/games/1/download', multisegment=True, block=True)

if __name__ == '__main__':
    main()

would you happen to have any insight on how I can get this to work?

mjishnu commented 1 month ago

hey, does this occur when its trying to combine the files, can you check the download folder and see the size of each file if all have same size it means its an issue in the combining process

Toylerrr commented 1 month ago

yes it does seem to have downloaded all the chunks then sits at 99%

mjishnu commented 1 month ago

will look into it. did you try again and faced same issue ? in some cases due to some i/o issue it can happen when you re-run script it should be fixed but if not then might be a bug somewhere

Toylerrr commented 1 month ago

Fresh try this AM after a server restart to see if that was the issue. Still sitting at 99%. Just a note I was troubleshooting a lot when I posted originally and I couldn't get it to work with gamevault.

image

Toylerrr commented 1 month ago

Interestingly enough if I do a non-multi segment download it does complete but doesn't give me the files just the JSON as a zip and says 401 error. Password is guaranteed correct.

{ "message": "Unauthorized", "statusCode": 401 }

mjishnu commented 1 month ago

Interestingly enough if I do a non-multi segment download it does complete but doesn't give me the files just the JSON as a zip and says 401 error. Password is guaranteed correct.

{ "message": "Unauthorized", "statusCode": 401 }

this is certainly weird if password was correct. what about size is it displaying any and you are passing it as aiohttp.basicauth right

mjishnu commented 1 month ago

Fresh try this AM after a server restart to see if that was the issue. Still sitting at 99%. Just a note I was troubleshooting a lot when I posted originally and I couldn't get it to work with gamevault.

image

ah now that i am looking, try and change name to something without whitespace that could be causing the combination not occur, try to set name to something like "booth" or something anything without white spaces also make sure the path doesn't have white spaces too. currently i am a bit busy i will try to reproduce it tomorrow sorry for the delay.

and another thing try and download with previous version of pypdl v1.3.2 ( note: there are change to class and attributes can check doc of 1.3.2 tag for more details)

mjishnu commented 1 month ago

with commit https://github.com/mjishnu/pypdl/commit/4fb506b3c6f720ac0a9a80aa25f83da77085a729 the issue regarding Unauthorized status while using single segment download has been fixed, it was caused by a typo

the issue regarding download stuck at 99% this is because of incorrect segment size which is caused due the a bug in Gamevault server. it was accepting non-inclusive range headers this is not a standarad practice as range headers should be inclusive

i have opened an issue regarding this in Gamevault repo: https://github.com/Phalcode/gamevault-backend/issues/298

Toylerrr commented 1 month ago

Thank you, this is something that I never would have figured out. I greatly appreciate your assistance and look forward to this fix on the pypdl as well as your fix on the gamevault repo.

mjishnu commented 1 month ago

Thanks for reporting, with v1.4.1 this should be fixed.