github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

sean808080 / twitnews forked from hackedunit/twitnews

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 2
  • Source
  • Commits
  • Network (2)
  • Downloads (0)
  • Graphs
  • Tree: 0b0d20e

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master
  • Switch Tags (0)
  • Comments
  • Contributors
Sending Request…

Applescript to post the currently selected news item in NetNewsWire to Twitter using bit.ly URL shortening with authentication and history.. — Read more

  Cancel

http://blog.tinucleatus.com/?tag=twitnews

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

modified for bit.ly authentication and history
sean808080 (author)
Thu Mar 04 17:07:12 -0800 2010
commit  0b0d20e2283b7b74ec55
tree    f27c166eb0222f7c1ba5
parent  ad797ca99026ed2f12e8
M Tweet it.scpt 33 ••••
Txt Tweet it.scpt
  • View file @ 0b0d20e
... ...
@@ -1,14 +1,21 @@
1  
--- Follow me on Twitter: http://twitter.com/hackedunit
  1
+--modified by @sean808080 to include bit.ly authentication and history
  2
+--follow @sean808080 at http://twitter.com/sean808080 or http://bit.ly/sean808080 
  3
+--based on original twitnews by tinu a.k.a. @hackedunit on twitter 
  4
+--usage enter your bit.ly login and api_key in the second and third lines below
  5
+--save to ~/Library/Application Support/NetNewsWire/Scripts
  6
+--Now you can access the script from the scripts menu on NetNewsWire. 
2 7
 
3 8
 set charcount_limit to 140
  9
+set login to "YOUR BITLY LOGIN"
  10
+set api_key to "YOUR BITLY API KEY"
4 11
 
5 12
 tell application "GrowlHelperApp"
6 13
   set the allNotificationsList to {"Success Notification", "Error Notification"}
7 14
   set the enabledNotificationsList to {"Success Notification", "Error Notification"}
8 15
   
9  
-  register as application Â
10  
-    "Twitnews" all notifications allNotificationsList Â
11  
-    default notifications enabledNotificationsList Â
  16
+  register as application Â¬
  17
+    "Twitnews" all notifications allNotificationsList Â¬
  18
+    default notifications enabledNotificationsList Â¬
12 19
     icon of application "NetNewsWire"
13 20
 end tell
14 21
 
... ...
@@ -25,16 +32,20 @@ tell application "NetNewsWire"
25 32
     set URL_list to URLs of tabs
26 33
     set title_list to titles of tabs
27 34
     set feed_url to item i of URL_list
  35
+    
28 36
     set feed_title to item i of title_list
29 37
   end if
30  
-  -- Build the GET request for the Tr.im API
31  
-  set feed_url to "http://api.tr.im/v1/trim_simple?url=" & feed_url
32  
-  -- Submit the GET request
33  
-  set cmd to "curl " & feed_url
34  
-  set feed_url to (do shell script cmd)
  38
+  
  39
+  set bitly to Â¬
  40
+    Â¬
  41
+      "curl --stderr /dev/null \"http://api.bit.ly/shorten?longUrl=" & feed_url & "&history=1&version=2.0.1&login=" & login Â¬
  42
+    & "&apiKey=" & api_key Â¬
  43
+    & "&history=1\"| grep shortUrl | grep -o http.*[/a-zA-Z0-9]"
  44
+  set bitly to (do shell script bitly)
  45
+  
35 46
 end tell
36 47
 
37  
-set tweet to feed_title & " " & feed_url
  48
+set tweet to feed_title & " " & bitly
38 49
 
39 50
 -- let the user edit the tweet
40 51
 set tweet_dialog to display dialog "Edit your Twitter status" with title "TwitNews" default answer tweet cancel button 1 default button 2 buttons {"Cancel", "Send"}
... ...
@@ -47,7 +58,7 @@ end if
47 58
 
48 59
 set charcount_tweet to (count characters of tweet)
49 60
 
50  
-if charcount_tweet ² charcount_limit then
  61
+if charcount_tweet â‰¤ charcount_limit then
51 62
   
52 63
   -- get login from keychain
53 64
   try

0 notes on commit 0b0d20e

Please log in to comment.
Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • ÄŒeÅ¡tina
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • СрпÑки
  • Svenska
  • 中文