Is it possible for twitter to read the latest tweet of CNN breaking news and speak it aloud?
Thanks,
Elijah
Model: MacBookPro
AppleScript: 2.3
Browser: Firefox 3.6
Operating System: Mac OS X (10.6)
Is it possible for twitter to read the latest tweet of CNN breaking news and speak it aloud?
Thanks,
Elijah
Model: MacBookPro
AppleScript: 2.3
Browser: Firefox 3.6
Operating System: Mac OS X (10.6)
set username to "cnn"
say getlasttweet(username)
on getlasttweet(username)
set myURL to "http://twitter.com/" & username
set content to do shell script "curl " & myURL
if content is not "<html><body>You are being <a href=\"http://twitter.com/suspended\">redirected</a>.</body></html>" and content does not contain "<h2>Sorry, that page doesn't exist!</h2>" and username is not "login" and username is not "home" then
if content contains "<a class=\"entry-date\" rel=\"bookmark\" href=\"" then
set text item delimiters to "<a class=\"entry-date\" rel=\"bookmark\" href=\""
set content to text item 2 of content
set text item delimiters to "\">"
set content to text item 1 of content
set lasttweet to do shell script "curl " & content & " | textutil -stdin -stdout -format html -convert txt -encoding UTF-8 "
set text item delimiters to "Login Join Twitter!\r\r"
set lasttweet to text item 2 of lasttweet
set text item delimiters to "\r"
set lasttweet to text item 1 of lasttweet
else
return ""
end if
else
display dialog "This username does not exist or is not available."
end if
end getlasttweet
How do I get rid of it saying these:
RT @cnnbrk: and http://on.cnn.com/dnn7hf
This happens at the beginning and at the end of the post.
…text item delimiters?
Sorry…I’m such a newb to applescrips…any way you can post a quick sample code?
BTW…thank you soooo much! I wouldn’t of been able to do ANYTHING with applescripts without you! (-:
set thetext to "Wee.:'/Whoa"
set AppleScript's text item delimiters to ".:'/"
set thelist to text items of thetext
(*set theitem to text item 2 of thetext*)