Skip to content

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

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.

8 Comments

  1. Pascal

    this script breaks for me.

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

    fixed it for me.

    Posted on 21-Feb-09 at 12:43 pm | Permalink
  2. Pascal

    (reformatting previous comment)

    change:

    my urlencode(stdfeed)

    to:

    set theTextEnc to my urlencode(stdfeed)

    Posted on 21-Feb-09 at 12:43 pm | Permalink
  3. The change above works fine. Unfortunately, I still can’t get the full-text of that darned Mac User feed.

    Posted on 21-Feb-09 at 2:05 pm | Permalink
  4. sjk

    Works for Paul Krugman’s NYT feed. Thanks!

    Posted on 22-Feb-09 at 12:44 am | Permalink
  5. @ Pascal: Interesting—not sure why the script works on my machine but needed that fix for yours. Updating the posted script to be safe.

    Posted on 22-Feb-09 at 12:13 pm | Permalink
  6. @ Don: Of the truncated feeds I subscribe to, the only ones FullTextRSS doesn’t work on are Freakonomics and Macworld.

    Posted on 22-Feb-09 at 12:20 pm | Permalink
  7. sjk

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

    Posted on 22-Feb-09 at 6:20 pm | Permalink
  8. Nick Naylor

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

    Posted on 31-Jul-09 at 12:40 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
FireStats icon Powered by FireStats