AppleScript名:XmlToDictKitでBlogのRSS情報を解析 |
— Created 2016-11-05 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "XmlToDictKit" –https://github.com/nicklockwood/XMLDictionary set aURL to "http://piyocast.com/as/feed/" set xRes to getLatestBlogInfo(aURL) of me on getLatestBlogInfo(aURLstring) set aURL to current application’s |NSURL|’s alloc()’s initWithString:aURLstring set xmlString to current application’s NSString’s alloc()’s initWithContentsOfURL:aURL encoding:(current application’s NSUTF8StringEncoding) |error|:(missing value) if xmlString = missing value then return false set xmlDoc to (current application’s NSDictionary’s dictionaryWithXMLString:xmlString) set blogTitle to (xmlDoc’s valueForKeyPath:"channel.title") as string –> "AS Hole(AppleScriptの穴) By Piyomaru Software" set titleList to (xmlDoc’s valueForKeyPath:"channel.item.title") as list –タイトル一覧 set urlList to (xmlDoc’s valueForKeyPath:"channel.item.link") as list –URL一覧 set descList to (xmlDoc’s valueForKeyPath:"channel.item.description") as list –本文のプレビュー一覧 set updateList to (xmlDoc’s valueForKeyPath:"channel.item.pubDate") as list –更新日時の一覧 return {first item of titleList, first item of urlList, first item of descList} end getLatestBlogInfo |
More from my site
(Visited 31 times, 1 visits today)