Git Product home page Git Product logo

Comments (13)

agourlay avatar agourlay commented on May 27, 2024 2

Thanks for the examples πŸ‘

For https://code.visualstudio.com/sha/download?build=stable&os=linux-x64 I am able to retrieve the proper file name via a HEAD query which contains the following header

"content-disposition": "attachment; filename=\"code-stable-x64-1639562789.tar.gz\""

So I can work this out.

However for https://atom.io/download/deb there is no info in the header, I don't know where the filename comes from.

Those are the headers retrieved:

{"connection": "keep-alive", "content-length": "137468500", "content-type": "application/octet-stream", "content-md5": "MjEM8AbNi9zFmSmtOmtYKw==", "last-modified": "Tue, 27 Jul 2021 05:51:40 GMT", "etag": "0x8D950C29B079281", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-request-id": "bc5c0b65-901e-0009-6a02-1967b6000000", "x-ms-version": "2009-09-19", "x-ms-lease-status": "unlocked", "x-ms-blob-type": "BlockBlob", "accept-ranges": "bytes", "age": "833", "date": "Thu, 03 Feb 2022 19:35:57 GMT", "via": "1.1 varnish", "x-served-by": "cache-hhn4028-HHN", "x-cache": "HIT", "x-cache-hits": "0", "x-timer": "S1643899557.434528,VS0,VE1"}

I will at least implement a fix for the first case.

from dlm.

agourlay avatar agourlay commented on May 27, 2024 2

Great to hear πŸ‘

The case for atom-amd64.deb?s=1627025597&ext=.part would not be super clean to handle and it does not look standard.
Happy to leave it as it is.

from dlm.

agourlay avatar agourlay commented on May 27, 2024 1

Was the original URL in the input file something like http://domain.com/get_video?id=Jw9Bym8mVafjmoX&expire?
That is, the actual filename is not part of the URL.

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024 1

Another site for test :

Original URL : https://code.visualstudio.com/sha/download?build=stable&os=linux-x64

Redirected URL : https://az764295.vo.msecnd.net/stable/899d46d82c4c95423fb7e10e68eba52050e30ba3/code-stable-x64-1639562789.tar.gz

I tested others tools like aria2c , They save the file based on redirected URL and with proper filename : code-stable-x64-1639562789.tar.gz

Or explicitly in browsers like Chrome, clicking on Original URL will give us the file with proper filename.

but dlm saves it with : download?build=stable&os=linux-x64part which is part of Original URL , in RAW mode, even without file extension.

Another site :

https://atom.io/download/deb

πŸ’Thanks a Million for all your efforts to improving this useful tool.πŸ’

from dlm.

agourlay avatar agourlay commented on May 27, 2024 1

Fix for the first case implemented in ec74c4d
It is released as part of 0.2.4

I do not know yet how to handle the second redirect case.

from dlm.

agourlay avatar agourlay commented on May 27, 2024 1

Thanks for the investigation, I will have to investigate the source code of aria2c.

I suspect it uses the Location header before redirection.

curl -i https://atom.io/download/deb 
HTTP/1.1 302 Found
Status: 302 Found
Location: https://atom-installer.github.com/v1.58.0/atom-amd64.deb?s=1627025597&ext=.deb

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024 1

Another test case : https://download.mozilla.org/?product=firefox-latest-ssl&os=osx&lang=en-US

Result :

user@user ~/Desktop/ % ./dlm -i dlm.txt -M 1 -o . --proxy http://127.0.0.1:10809 -U 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36'
[2022-02-04 14:29:13] Starting dlm with at most 1 concurrent downloads
[2022-02-04 14:29:13] Found 1 URLs in input file d.txt
[2022-02-04 14:29:17] Could not determine file extension for https://download.mozilla.org/?product=firefox-latest-ssl&os=osx&lang=en-US
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0/1
?product=firefox-latest-ssl&os=osx& [00:00:11] [>---------------------------------------] 814.95KiB/120.90MiB (speed:63.31KiB/s) (eta:32m)

Current output name : ?product=firefox-latest-ssl&os=osx&lang=en-US.part

True desired name : Firefox 96.0.3.dmg

aria2c output :

user@user ~ % aria2c 'https://download.mozilla.org/?product=firefox-latest-ssl&os=osx&lang=en-US'

02/04 14:33:58 [NOTICE] Downloading 1 item(s)
[#fe3133 0B/0B CN:1 DL:0B]                                                                                                                                  
02/04 14:33:59 [NOTICE] CUID#7 - Redirecting to https://download-installer.cdn.mozilla.net/pub/firefox/releases/96.0.3/mac/en-US/Firefox%2096.0.3.dmg                                                                                                             
[#fe3133 16KiB/120MiB(0%) CN:3 DL:60KiB ETA:34m10s]                                                                                                         
                                                                                            
02/04 14:34:03 [NOTICE] Download GID#fe313386b4ecf94a not complete: /home/user/Firefox 96.0.3.dmg

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
fe3133|ERR |   369KiB/s|/home/user/Firefox 96.0.3.dmg

from dlm.

agourlay avatar agourlay commented on May 27, 2024 1

I pushed a fix for using the Location header if possible in case of redirect.
You can give it a try in 0.2.5.

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024

I will test the other cases and report here.

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024

Yet it's not able to detect and assign correct filename for some cases :

β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0/1
get_video?id=1xR4wp8e8DtdwW&expires [00:00:10] [>---------------------------------------] 7.25MiB/311.03MiB (speed:732.60KiB/s) (eta:7m)

above case is : https://streamtape.com/

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024

I'm wondering how aria2c can detect and assign the name of any redirected URL πŸ€” , even https://atom.io/download/deb or https://streamtape.com/

output of aria2c (i hope it could help) :

user@user ~/Desktop % aria2c 'https://atom.io/download/deb'

02/04 14:09:26 [NOTICE] Downloading 1 item(s)
[#98b0bb 0B/0B CN:1 DL:0B]                                                                                                                                                                         
02/04 14:09:28 [NOTICE] CUID#7 - Redirecting to https://atom-installer.github.com/v1.58.0/atom-amd64.deb?s=1627025597&ext=.deb
[#98b0bb 896KiB/131MiB(0%) CN:4 DL:0B]                                                                                                                                                             

02/04 14:09:34 [NOTICE] Download GID#98b0bbd9992214d0 not complete: /home/user/Desktop/atom-amd64.deb

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
98b0bb|INPR|       0B/s|/home/user/Desktop/atom-amd64.deb

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024

Test result of 0.2.5 :

StreamTape : SUCCESSFUL name assigning βœ…
VSCode : SUCCESSFUL name assigning βœ…
Atom : as atom-amd64.deb?s=1627025597&ext=.part but acceptable βœ…
Firefox : SUCCESSFUL name assigning βœ…

from dlm.

chromer030 avatar chromer030 commented on May 27, 2024

I think the issue is closed, dlm working well in this feature, really thanks a million for your efforts.

from dlm.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.