in applescript

NetNewsWire script: Subscribe to full-text feed of current subscription

Update Dec 2010: it looks like FullTextRSS is down. I’ll leave this up, but be forewarned: it probably won’t work. FiveFilters and WizardRSS provide similar services, so you may want to look there.

Here’s a script that attempts to subscribe to a full-text feed of the current subscription in NetNewsWire. It does this using EchoDittoLabs’ excellent FullTextRSS service.

To use, select a headline or subscription title in NetNewsWire and run the script. The full-text feed will appear in your top-level items.

Thanks to harvey.nu for the URL encoding routine. The script worked without the routine but it seemed safer to include it.

[Updated 2/22 with change suggested by Pascal.]

(*
Fulltextrss.scpt v 0.1b

Attempts to subscribe to the current subscription via
EchoDittoLabs’ FullTextRSS service (echodittolabs.org/fulltextrss)

Contains no error checking; use at your own risk

Dan Byler dbyler@gmail.com
*)


property fulltextpre : "http://labs.echoditto.com/projects/fulltextrss/?url="

tell application "NetNewsWire"
        if exists selectedHeadline then
                set this_headline to selectedHeadline
                set stdfeed to RSS URL of subscription of selectedHeadline
        else if exists selectedSubscription then
                set stdfeed to RSS URL of selectedSubscription
        end if
        try
                set theTextEnc to my urlencode(stdfeed)
                set fulltextfeed to fulltextpre & theTextEnc
                set theresult to subscribe to fulltextfeed
        on error
                display dialog "Oops—something went wrong."
                return
        end try
end tell

— urlencode routine taken from http://harvey.nu/applescript_url_encode_routine.html
on urlencode(stdfeed)
        set theTextEnc to ""
        repeat with eachChar in characters of stdfeed
                set useChar to eachChar
                set eachCharNum to ASCII number of eachChar
                if eachCharNum = 32 then
                        set useChar to "+"
                else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
                        set firstDig to round (eachCharNum / 16) rounding down
                        set secondDig to eachCharNum mod 16
                        if firstDig > 9 then
                                set aNum to firstDig + 55
                                set firstDig to ASCII character aNum
                        end if
                        if secondDig > 9 then
                                set aNum to secondDig + 55
                                set secondDig to ASCII character aNum
                        end if
                        set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
                        set useChar to numHex
                end if
                set theTextEnc to theTextEnc & useChar as string
        end repeat
        return theTextEnc
end urlencode

Download a copy here.

For those with something to say:

Comment

15 Comments

  1. this script breaks for me.

    changing: my urlencode(stdfeed) to: set theTextEnc to my urlencode(stdfeed)

    fixed it for me.

  2. (reformatting previous comment)

    change:

    my urlencode(stdfeed)

    to:

    set theTextEnc to my urlencode(stdfeed)

  3. @ Pascal: Interesting—not sure why the script works on my machine but needed that fix for yours. Updating the posted script to be safe.

  4. @ Don: Of the truncated feeds I subscribe to, the only ones FullTextRSS doesn’t work on are Freakonomics and Macworld.

  5. Original script didn’t work for me either until I applied Pascal’s fix. OS X 10.5.6, NNW 3.1.7.

  6. This is a great script! I have been looking for something like this for some time. Thank you so much!

  7. Unfortunatley doesn’t work for me.

    I loaded the script in the sript folder of nnw…nothing happened.

    Am I doing wrong?

    Help appreciated

  8. Dirk,

    Unfortunately it looks like the EchoDittoLabs service is no longer operational, so my script won’t help. In the meantime you might want to check out fivefilters.org—they have a similar service.

    Cheers, Dan

  9. Been looking for this for quit sometime now. will try this and thank you for sharing.