Search code examples
pythonpython-3.xpython-requestsdownloaddownload-manager

Download a file from different url if the current url fails without restarting from beginning


i have an api which returns the url of a file that i want to download, but the link expires after 10-15 min so when the link dies is there anyway to change the dead url and download it from a new one, and resume the download where it left off, instead of restarting from the beginning.

i am currently using pysmartDL to download the file to remove any bandwidth limitation set by the server but this doesnt work for big files > 5GB where the download takes more than 10 min for my current network connection

    obj = SmartDL(remote_url, path)
    obj.start()

Solution

  • we can use a module called pypdl for this it has the ability to do this and many more features

    for more info check the project page: https://pypi.org/project/pypdl/