애플 스크립트로 워드프레스 포스팅 가져오기

애플 스크립트와 XML-RPC

애플 스크립트는 XML-RPC를 자체적으로 지원합니다. 이를 이용하면 워드 프레스에 게시했던 포스트들을 XML-RPC를 이용해 맥의 어플리케이션으로 가져올 수 있습니다.
다음의 애플 스크립트는 워드 프레스의 포스트를 맥저널로 가져오는 작업을 처리합니다.


tell application "http://stratosphere631.com/wp/xmlrpc.php"
  set blog to ¬
      call xmlrpc {method name:"wp.getUsersBlogs", parameters:{"", ""}}
  set posts to ¬
     call xmlrpc {method name:"mt.getRecentPostTitles", parameters:{0, "", "", 0}}
  tell application "MacJournal"
      choose journal
     set blogjournal to result
  end tell
   repeat with post in posts
      set doc to ¬
           call xmlrpc {method name:"metaWeblog.getPost", parameters:{postid of post, "", ""}}
        tell application "MacJournal"
          tell blogjournal
               make new journal entry with properties {name:title of doc, date:datecreated of doc, plain text content:description of doc}
             set entry to result
                convert to plain text entry
            end tell
       end tell
   end repeat
end tell


하지만 이 스크립트는 포스트의 텍스트만을 가져올 뿐 텍스트의 내용을 기반으로 리치 텍스트로 변환하거나 포스트에 포함된 이미지를 가져오지 않기 때문에 포스트의 포맷이나 이미지는 포함되지 않게됩니다.

Comments are closed.

Website Built by WordPress.com.

Up ↑