Lenny Domnitser’s
domnit.org

⇙ Jump to content

explicit

This is a static archive of the domnit.org blog,
which Lenny Domnitser wrote between 2006 and 2009.

wget from Firefox

I use wget for big downloads because of its simplicity and reliability. Coupled with screen, it will keep working through a Firefox crash or even an X windows crash. I got tired of copying and pasting URLs into a terminal, so I wrote some glue code to make it work in two (or one) clicks.

First, save this tiny helper script to your computer and make it executable. Mine is named ~/bin/x-wget-url. This is for GNOME, so if you’re using KDE, Mac OS X, or something else, you’ll have to modify it. You can also make a similar batch script for Windows.

#!/bin/sh
cd ~/Desktop
gnome-terminal --hide-menubar --title=wget -x screen wget -i $1

Next, open this setup link in Firefox. Firefox will ask you what to do with the file. Select “Open with”, browse to the script, check “Do this automatically”, and press OK.

Now that Firefox knows how to open wget as a helper, you can start rewriting links by prepending data:application/x-wget-url, to them. The easiest way is the wget next bookmarklet, available at my bookmarklets page. Usage: 1. click wget next. 2. click a link. That’s it.

Greasemonkey can also be used to automatically rewrite some links. I wrote a small script to download Revision3 videos with wget. Similar scripts can be written trivially.

Maybe when Firefox is more mature this won’t be necessary, but for now this setup makes the robust wget as convenient as downloading directly in the browser.