Way to Initiate Download remotely to another computer

browserdownloadPROXYwget

I'm looking for a solution between a proxy and wget, since neither fully addresses the issue I'm trying to solve.

I want to download files to a specific directory on my home machine (a Linux server – command-line only) from remote places (via smartphone, web browser, etc.). This sounds like a solution for wget, except many of the files I would download come from sources that create special download "sessions" for you via AJAX/Javascript (e.g. Uploaded.net, Mega.nz).

I imagine I would have to use a proxy at some point in this process, but I don't want the download data to come to my remote device at all, since that would waste bandwidth. But, to use a proxy to access the sites and create the sessions would work for me.

So, solutions that don't work (out-of-the-box, at least):

  • Remote Desktop: Windows only
  • VNC: I only have command-line access; also, not so friendly with smartphones and the like
  • wget: download links generally only exist for a "session"; very difficult to emulate AJAX environment for sites
  • proxy: sends all data to remote client; mounting the remote directory would cause the data to take three hops (site to proxy, server/proxy to client, client to remote directory). I'm looking for a direct (site to remote directory) route for the download.

In my perfect world, I'm envisioning browsing to a site via a proxy, but then when the browser classifies something as a Download, it just downloads to the remote directory (or even opens a file Save dialog and lets me choose where to save it on the remote server). The solution doesn't have to have this level of simplicity, but hopefully this helps clarify the thrust of my question.

Best Answer

wget has options to save and load cookies. Sometimes depending on the site if you use wget to load the webpage that the link is on and tell it to save cookies, then make another request for the actual file and have it load the cookies it will work.

It's a two step process like this:

wget --cookies=on --keep-session-cookies --save-cookies=cookie.txt http://domain.com/page_with_link.html
wget --referer=http://domain.com/page_with_link.html --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt http://domain.com/some_file_to_download.zip