• TwitNews – Post to Twitter from NetNewsWire

    Just mashed up a quick applescript to post the currently selected news item in NetNewsWire to Twitter. The code is highly influenced from TwiTunes, (which posts the current track on iTunes to Twitter) and the Shorten URL script from iconmaster. So all credits goes to them.

    By default, the contents of the tweet is set to the title of the news item and the URL is shortened using is.gd and you can easily customize it.

    The script needs you to save your Twitter login credentials in your keychain or else you will get an error. To do this, tell Safari to save your login details to Keychain while you login to Twitter or you can do it manually in the keychain app by selecting ‘New password item’ and set Keychain item name as http://twitter.com and fill in your Twitter username and password in the following fields.


    Download the script TwitNews, uncompress and drop it into ~/Library/Application Support/NetNewsWire/Scripts. Now you can access the script from the scripts menu on NetNewsWire.


    If you want to have a look at the code:

    tell application "NetNewsWire"
    if index of selected tab = 0 then
    -- We're looking at headlines, so just get the headline URL
    set feed_url to URL of selectedHeadline
    set feed_title to title of selectedHeadline
    -- We're looking at a web view tab, so we need to know which tab
    set i to index of selected tab
    set i to i + 1
    -- Get the tab's URL
    set URL_list to URLs of tabs
    set title_list to titles of tabs
    set feed_url to item i of URL_list
    set feed_title to item i of title_list
    end if
    -- Build the GET request for the is.gd API
    set feed_url to "http://is.gd/api.php?longurl=" & feed_url
    -- Submit the GET request and copy the results to clipboard
    set cmd to "curl " & feed_url
    set feed_url to (do shell script cmd)
    end tell

    -- change the status message to your liking here:
    set tweet to feed_title & " " & feed_url

    -- let the user edit
    display dialog "Edit your Twitter status" with title "TwitNews" default answer tweet cancel button 1 default button 2 buttons {"Cancel", "Send"}
    set tweet to (text returned of result)

    -- get login from keychain
    tell application "Keychain Scripting"
    set twitter_key to first Internet key of current keychain whose server is "twitter.com"
    set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
    end tell

    -- post to twitter
    set twitter_status to quoted form of ("status=" & tweet)
    set results to do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " http://twitter.com/statuses/update.json"

    Hope you find this useful and feel free to make any changes as you need.

    UPDATE: You might want to check this post to assign a keyboard shortcut to the script.

    UPDATE: There is an updated version available with some new features. Please see this post.

    • http://www.kitab.nl/ sami

      many thanks, was looking for something like this

    • http://www.hypenotic.com Barry

      Is there any chance I could convince you to make one for Pingfm as well?

    • dab

      thank you so much! just what i was looking for!

    • http://livemediaproductions.com/ David

      Thanks for the script! It works perfectly!

      I was actually planning out how to write one of these, and ran across yours, so thanks for saving me a bit of time.

    • http://www.liewcf.com Liew Cheon Fong

      it works great. thanks!

    • http://twitter.com/eddie_e65 eddie_e65


      I was looking for a plug in like this script!!

    • vandy

      I have two twitter accounts, how can I get to choose which one it posts to?

    • http://my.opera.com/mkrzych Krzysztof Maj

      very useful script! I was looking for something like that. Thanks a lot!

    • Gulumbit

      Thanks for the script – very helpful. For some reason I couldn’t get it to work with my Keychain but managed a workaround.

      For any others, who like me, have no scripting skills, this is the edit I used:

      – get login from keychain
      tell application “Keychain Scripting”
      set twitter_key to first Internet key of current keychain whose server is “twitter.com”
      set twitter_login to quoted form of (account of twitter_key & “:” & password of twitter_key)
      end tell

      Added instead:
      – Set Twitter username and password
      set twitter_username to “enter_your_twitter_username”
      set twitter_password to “enter_your_twitter_password”
      set twitter_login to quoted form of (twitter_username & “:” & twitter_password)

    • http://gdayworld.com Cameron Reilly

      I’ve been using (and loving) the TwitNews script but now it seems to have stopped working. I’m wondering if the NetNewsWire upgrades have buggered it? Anyone else experiencing problems all of a sudden?

    • http://www.tinucleatus.com Tinu Cleatus

      @Cameron I just checked this with the NNW beta and it works fine. Maybe you should update to the latest NetNewsWire beta. I’m using 3.2b24.

    • http://instantaction.com Crash7800

      Used Twitter App in facebook to send this on as my Facebook status. WIN! Thanks! :) Any way to map this to a hotkey?

    • Pingback: TwitNews Keyboard Shortcut | making things work

    • Cameron Reilly

      @Tinu, I’m running what I believe is the latest version of NNW (3.2b.25) and I’ve just uninstalled and reinstalled the script but it’s still not posting. The pop-up box appears, looks fine, I hit “send”, the box disappears, but no tweet is sent. It’s strange.

    • Pingback: How to Post Links to Twittter from Netnewswire | Robin Malau Dot Com

    • http://ipatrix.com Patrix

      Awesome. I had the same problem as Cameron. But I deleted the Twitter entries in keychain, uninstalled the script and tried again. Worked like a charm. Thanks a lot for this script.

      My Twitter followers will not be inundated with ‘interesting’ links. Bwhahaha!

    • http://ipatrix.com Patrix

      I got this error msg when I tried posting my second link – http://bit.ly/4H0ETd.

      Any idea of what’s happening?

    • Pingback: De NetNewsWire a Twitter

    • Flanker

      Gulumbit: Thanks, your code-fix made this work like a charm! Excellent :)

    • http://font.is Sigurdur Armannsson

      Thanks very much for this script and Gulumbit for the additional fix. Works like a charm with NNW and TweetDeck. Tweeted about this script of course.

    • http://www.koodoz.com.au Koodoz Design

      Thanks Tinu for this great script.

      FYI, this doesn’t seem to work with 10.5.8 or 10.6+. However, Gulumbit’s small hack seems to do the trick! Thanks :)

      The one thing I noticed though, was when copying the new code into the script editor, the quotation marks (“ ”) that are displayed within the code snippet will make the script unable to compile/work. So if anyone has troubles with the code that Gulumbit has provided, the likely problem is that you need to change all instances of “ ” to ” “.

    • Pingback: Where are the new/updated Twitter Clients? | SchackNetz

    • Pingback: Post to Pinboard in NetNewsWire | BlogHalt.com (Pre-Launch)

    • Pingback: Post News to Twitter from NetNewsWire – Aceh Mac Club - Mac OS X

    • Pingback: Twitnews update | making things work

    • http://contentandcode.org gitano

      Thanks! Works very well.

    • http://www.tinucleatus.com Tinu Cleatus

      There is an updated version of Twitnews available with some new features. Please see this post http://blog.tinucleatus.com/?p=346

    • Pingback: Learn by Exploring Your Tools

    • Pingback: Manage Your RSS Feed In Mac With NetNewsWire – Make Tech Easier

    • Pingback: Quản lý RSS Feed trong Mac với NetNewsWire « Net24h.info

    • Pingback: Quản lý RSS Feed trong Mac với NetNewsWire « Le Viet Thanh Professional's Blog

    • http://www.computerworld.com/ Deesycype

      Amazon launched two new Kindle e-readers priced at $139 and $189 late Wednesday, with the cheaper version a Wi-Fi-only e-reader and $10 less than the Wi-Fi-only Nook.


    • http://www.bennnyhits.com lose weight

      Thanks bud. Nice article you got going on here. Got some more links to direct to which have more stuff like this?

    • http://www.techinpost.com/ Techinpost.com

      Good Day I Am So Happy I Found Your Website, I
      Found You By Mistake, While I Was Searching On Aol For
      Something Else, Anyhow I Am Here Now And Would Just Like To Say Many Thanks For
      A Remarkable Post And An All Round Entertaining Blog
      I Don’t Have Time To Read It, All At The Moment But I Have BookMarked It
      And Also Added In Your RSS Feeds, So When I Have Time I Will Be Back To Read More,
      Please Do Keep Up The Fantastic Job. You can also check; http://www.techinpost.com/fixed-error-550-code-problem-microsoft-outlook