Automatic placment of Salon news on desktop

Jun 18, '02 09:39:37PM

Contributed by: Mitchell

I'm a subscriber to the premium edition of Salon.com, and I like to skim through it every weekday morning while I'm having my breakfast. Thanks to AppleScript, cUrl, and cron, I can have it ready for me by the time the coffee's finished.

Read the rest of the article for the how-to...

My subscriber information is saved in a cookie. Although OmniWeb keeps track of it just fine, cUrl wants its cookies in the Netscape/Mozilla format. I downloaded Netscape, logged into Salon once with my subscriber info, deleted all the non-salon cookies, and copied the truncated cookies.txt file to ~/Library/Cookies/cookies.txt.

This is the code that I put into AppleScript (finding the date and time workarounds online somewhere I have forgotten -- sorry original author).

copy ((offset of (the month of (current date)) in ¬
"jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
as integer to mo
if mo < 10 then copy "0" & mo as string to mo
copy day of (current date) to da
if (day of (current date) < 10) then copy "0" & da as string to da
copy "http://www.salon.com/premium/downloads/Salon_" & (year of ¬
(current date) as string) & mo & da & ".html" to getItHere
copy "~/Desktop/'Salon for " & da & " " & (month of (current date) ¬
as string) & " " & (year of (current date) as string) & ".html" & "'" to putItThere
do shell script ("curl -b ~/Library/Cookies/cookies.txt -o " & putItThere & " " & getItHere)
I also pointed my crontab at this script to run every weekday morning at 0715, so that I can have my Salon with my breakfast.

This should work pretty much as is with any cookie-secured website, and cUrl has many other features for other things you may need to check frequently.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020618213937475