2013-03-10 4 views
0

AppleScript로 최신 트윗을 얻고 싶습니다. 그러나 "status"변수는 저장할 수 없습니다. 트윗 상태 개체를 저장하는 방법은 무엇입니까?AppleScript를 사용하여 트윗을 얻는 방법

그것은 노력하고 있습니다 : 그것은 작동하지 않습니다

tell application "Twitter" 
    set tw to text of item 1 of statuses of home timeline of current account 
end tell 

:

tell application "Twitter" 
    set tw to item 1 of statuses of home timeline of current account 
    set txt to text of tw 
end tell 
+0

코드를 공유 할 수 있습니까? 코드없이 당신을 도울 수는 없지만 ... –

+0

죄송합니다, 저는 질문문의 형식이 고정되어 있습니다. –

답변

1

비트는 그것을 언급하지만, 내 애플 맥 앱 스토어에서 무료로 사용 가능한 "Twitter Scripter"를 살펴합니다.

이것은 AppleScript에서 Twitter API에 액세스 할 수 있도록 설계된 얼굴이없는 배경 응용 프로그램입니다. 그것은 OS X (10.8 이상)에서 기본 트위터 지원을 피기 때문에 모든 인증을 직접 처리 할 필요가 없습니다. 트위터 API의 응답을 구조화 된 AppleScript 레코드로 가져올 수 있습니다. 예를 들어

:

tell app "Twitter Scripter" 
    set myTwitterAccount to item 1 of (available accounts) as string 
    -- User timeline: This function retrieves the Tweets for a given user name 
    fetch user timeline for username "mousedownsoft" using account myTwitterAccount with excluding replies and including retweets 
end 
1

이 Twitter.app의 애플 스크립트를 지원하는 이상한 일이,하지만 당신은 단지 여러 속성을 얻을 필요가 있다면, 당신은 사용할 수 있습니다 말 블록 또는 병렬 할당.

tell application "Twitter" 
    tell item 1 of statuses of home timeline of current account 
     set t to text 
     set u to url 
     properties 
    end tell 
    -- set {t, u} to {text, url} of item 1 of statuses of home timeline of current account 
end tell 

대신 API를 사용할 수 있습니까? sudo gem install twitter을 실행하고 dev.twitter.com에 응용 프로그램을 등록하는 경우이 작업이 작동합니다. 그날 늦게

require 'rubygems' 
require 'twitter' 

Twitter.configure { |config| 
    config.consumer_key = "" 
    config.consumer_secret = "" 
    config.oauth_token = "" 
    config.oauth_token_secret = "" 
} 

p Twitter.home_timeline.first.text 
p Twitter.home_timeline.first.inspect 
+0

아주 좋은 대답에 감사드립니다! –

관련 문제