These days, tons of directories, aggregators, filters, and
weblogs point to interesting types of media. You can use wget to create a text-file
list of your favorite sites that, say, link to MP3 music files, and schedule it to
automatically download any newly added MP3s from those sites each day to your
computer.2
Here’s how:
1. Create a text file called mp3_sites.txt and list URLs of your favorite
sources of music online (such ashttp://del.icio.us/tag/system:filetype:mp3 or http://stereogum.com), one per line.
2. Use the following wget command to go out and fetch those MP3s:
wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off -i mp3_sites.txt
That wget
recipe recursively (-r) downloads only MP3 files
(-A.mp3) linked from the sites (-H) one level out (-l1) listed in mp3_sites.txt
(-i
mp3_sites.txt) that are newer (-N) than any you’ve already downloaded. There are a few other
specifications in there — such as to not create a new directory for every music file
(-nd), to ignore robots.txt (-erobots=off), and to not
crawl up to the parent directory of a link (-np).
When this command is scheduled with the list of sites you specify, you
get an ever-refreshed folder of new music files that wget fetches for you. With a
good set of trusted sources, you’ll never have to go looking for new music again —
wget can do all the work for you.
TIP Use this technique to download
all your favorite bookmarks for offline usage as well. If you keep your
bookmarks online in Delicious, use wget to
download the contents of your favorite pages to your hard drive. Then, using
Google Desktop Search, you can search the contents of your bookmarks even when
you’re offline.
Automate wget Downloads on Windows
To schedule a wget download
task to run at a certain time, open a new document in a plain-text editor such as
Notepad. Type the wget command you want to schedule,
and save the file with a .bat extension, such as
getnewmusic.bat.
In Windows Task Scheduler, browse to getnewmusic.bat in the Programs section, and set the schedule as
usual.
NOTE See Hack 64, “Automatically
Reboot and Launch Applications,” for more details on setting up a recurring job
in Windows Task Scheduler.
weblogs point to interesting types of media. You can use wget to create a text-file
list of your favorite sites that, say, link to MP3 music files, and schedule it to
automatically download any newly added MP3s from those sites each day to your
computer.2
Here’s how:
1. Create a text file called mp3_sites.txt and list URLs of your favorite
sources of music online (such ashttp://del.icio.us/tag/system:filetype:mp3 or http://stereogum.com), one per line.
2. Use the following wget command to go out and fetch those MP3s:
wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off -i mp3_sites.txt
That wget
recipe recursively (-r) downloads only MP3 files
(-A.mp3) linked from the sites (-H) one level out (-l1) listed in mp3_sites.txt
(-i
mp3_sites.txt) that are newer (-N) than any you’ve already downloaded. There are a few other
specifications in there — such as to not create a new directory for every music file
(-nd), to ignore robots.txt (-erobots=off), and to not
crawl up to the parent directory of a link (-np).
When this command is scheduled with the list of sites you specify, you
get an ever-refreshed folder of new music files that wget fetches for you. With a
good set of trusted sources, you’ll never have to go looking for new music again —
wget can do all the work for you.
TIP Use this technique to download
all your favorite bookmarks for offline usage as well. If you keep your
bookmarks online in Delicious, use wget to
download the contents of your favorite pages to your hard drive. Then, using
Google Desktop Search, you can search the contents of your bookmarks even when
you’re offline.
Automate wget Downloads on Windows
To schedule a wget download
task to run at a certain time, open a new document in a plain-text editor such as
Notepad. Type the wget command you want to schedule,
and save the file with a .bat extension, such as
getnewmusic.bat.
In Windows Task Scheduler, browse to getnewmusic.bat in the Programs section, and set the schedule as
usual.
NOTE See Hack 64, “Automatically
Reboot and Launch Applications,” for more details on setting up a recurring job
in Windows Task Scheduler.
No comments:
Post a Comment