我正在尝试通过Mac Twitter应用中的推文获取作者ID。
tell application "Twitter"
properties of item 3 of status of (home timeline of account 1)
end tell
tell application "Twitter"
author of item 3 of status of (home timeline of account 1)
end tell
如何隔离“128938832”?
解决方案:来自AppleScript-Users邮件列表的Chris刚回答了我的问题。 author属性具有用户标识属性。 user id of author of item 3 of status of (home timeline of account 1)
返回“128938832”。
答案 0 :(得分:1)
我没有Twitter,但如果没有条款来获取作者的ID,您可能会因强制错误并从错误消息中提取数字而作弊,例如:
tell application "Twitter" to try
(author of item 3 of status of (home timeline of account 1)) as number -- force error
on error errmess -- extract info from the error message
set here to (offset of quote in errmess) + 1 -- first quote
set there to here + (offset of quote in (text here thru -1 of errmess)) - 2 -- second quote
set authorID to text here thru there of errmess
end try