Politics, Programming and Possibilities
18 Feb
I added a few improvements to the Ubiquity “download-files” command. It now checks everything on the page, including frames and iframes. Also, it walks through all of the CSS files and downloads image assets if they match the pattern you specify.
Visit Ubiquity Download Files on GitHub to see the code, or this gist to subscribe.
4 Responses for "Improvements to download-files command"
First: your command is incredibly useful. I’m mystified as to how this wasn’t among the first commands the ubiquity team included, but in any case thanks for sharing!
I think I’m about to embarrass myself, but since a fair bit of reading hasn’t shed much light I’ll ask a couple of questions.
1) There seem to be a couple of different conventions for regular expression syntax. Am I correct in understanding that javascript uses perl type regular expressions?
2) How do you delimit the pattern? I can’t figure out how to specify a destination directory because it thinks I’m adding to the pattern. For example, I’m trying to match a file foo.cpp, so I do:
download-files cpp$ ~/Desktop/destination
and when I add the path the message changes from “Download files matching /cpp$/” to “No files match the regular expression /cpp$ ~/Desktop/destination/”.
Since the /’s are provided automatically how does one distinguish between the pattern and the path?
Thanks again, and thanks for the help if you’ve got time
@Chris: Thanks! I’m glad you like it. I think the issue you’re having is caused by the lack of the magic keyword “to”… you need to include that if you want to specify the destination folder:
download-files cpp$ to ~/Desktop/destination
Also, if you don’t want to include a destination that’s ok too, and a pop-up window will let you specify (or create) the destination folder using the system dialog.
Thanks! Got it working now. I noticed that the help (i.e. text you get from ‘help download-files’) omits the magic keyword. Also, FWIW, on OS X leaving the destination unspecified caused firefox to crash until I updated to ubiquity 1.7. Obviously, the user is not so great, and I haven’t tried to downgrade and reproduce the problem, so that may mean nothing. Just figured I’d mention it in case the data is useful.
Cheers
@Chris: Ah! Thanks for pointing out the mistake in the help area. That should be fixed now.
I’ll see if I can reproduce the FF crash.
Leave a reply