AppleScript名:GET method REST API_Anime API_getInfo_in_a_year v2 |
— Created 2016-05-11 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set reqURLStr to "http://api.moemoe.tokyo/anime/v1/master/" & "2016" set aRes to callRestGETAPIAndParseResults(reqURLStr) of me set aRESTres to json of aRes set aRESCode to responseCode of aRes –> 200 set aRESHeader to (responseHeader of aRes) as list of string or string –as anything –> {Connection:"keep-alive", Access-Control-Allow-Origin:"*", Content-Type:"application/json; charset=utf-8", Content-Length:"353", Server:"nginx/1.8.0", Date:"Wed, 11 May 2016 01:14:49 GMT"} return aRESTres as list of string or string –> {{id:281, title:"機動戦士ガンダム サンダーボルト"}, {id:282, title:"プリンス・オブ・ストライド オルタナティブ"}, {id:283, title:"無彩限のファントム・ワールド"}, {id:284, title:"ハルチカ〜ハルタとチカは青春する〜"}, {id:285, title:"ノルン+ノネット"}, {id:286, title:"アクティヴレイド -機動強襲室第八係-"}, {id:287, title:"少女たちは荒野を目指す"}, {id:288, title:"僕だけがいない街"}, {id:289, title:"おじさんとマシュマロ"}, {id:290, title:"ファンタシースターオンライン2 ジ アニメーション"}, {id:291, title:"だがしかし"}, {id:292, title:"暗殺教室(第2期)"}, {id:293, title:"ディバインゲート"}, {id:294, title:"おしえて!ギャル子ちゃん"}, {id:295, title:"石膏ボーイズ"}, {id:296, title:"霊剣山 星屑たちの宴"}, {id:297, title:"GATE 自衛隊 彼の地にて、斯く戦えり(2期)"}, {id:298, title:"昭和元禄落語心中"}, {id:299, title:"紅殻のパンドラ"}, {id:300, title:"ブブキ・ブランキ"}, {id:301, title:"ラクエンロジック"}, {id:302, title:"デュラララ!!×2 結"}, {id:303, title:"ナースウィッチ小麦ちゃんR"}, {id:304, title:"虹色デイズ"}, {id:305, title:"大家さんは思春期!"}, {id:306, title:"Dimension W"}, {id:307, title:"灰と幻想のグリムガル"}, {id:308, title:"シュヴァルツェスマーケン"}, {id:309, title:"最弱無敗の神装機竜(バハムート)"}, {id:310, title:"赤髪の白雪姫(第2期)"}, {id:311, title:"てーきゅう(第7期)"}, {id:312, title:"魔法少女なんてもういいですから。"}, {id:313, title:"蒼の彼方のフォーリズム"}, {id:314, title:"この素晴らしい世界に祝福を!"}, {id:315, title:"亜人"}, {id:316, title:"FAIRY TAIL ZERO"}, {id:317, title:"ももくり"}, {id:318, title:"この男子、魔法がお仕事です。"}, {id:319, title:"SUSHI POLICE"}, {id:320, title:"血液型くん!4"}, {id:321, title:"迷家‐マヨイガ‐"}, {id:322, title:"宇宙パトロールルル子"}, {id:323, title:"機動戦士ガンダムユニコーン RE:0096"}, {id:324, title:"影鰐-KAGEWANI-承"}, {id:325, title:"ぼのぼの"}, {id:326, title:"フューチャーカード バディファイト トリプルディー"}, {id:327, title:"逆転裁判"}, {id:328, title:"学戦都市アスタリスク 2nd SEASON"}, {id:329, title:"僕のヒーローアカデミア"}, {id:330, title:"マクロス⊿"}, {id:331, title:"コンクリート・レボルティオ~超人幻想~THE LAST SONG"}, {id:332, title:"くまみこ"}, {id:333, title:"怪盗ジョーカー(シーズン3)"}, {id:334, title:"ばくおん!!"}, {id:335, title:"聖戦ケルベロス 竜刻のファタリテ"}, {id:336, title:"ハンドレッド"}, {id:337, title:"薄桜鬼~御伽草子~"}, {id:338, title:"ジョーカー・ゲーム"}, {id:339, title:"双星の陰陽師"}, {id:340, title:"SUPER LOVERS"}, {id:341, title:"鬼斬"}, {id:342, title:"文豪ストレイドッグス"}, {id:343, title:"あんハピ♪"}, {id:344, title:"クロムクロ"}, {id:345, title:"ネトゲの嫁は女の子じゃないと思った?"}, {id:346, title:"甲鉄城のカバネリ"}, {id:347, title:"少年メイド"}, {id:348, title:"坂本ですが?"}, {id:349, title:"田中くんはいつもけだるげ"}, {id:350, title:"キズナイーバー"}, {id:351, title:"はいふり"}, {id:352, title:"ふらいんぐうぃっち"}, {id:353, title:"とんかつDJアゲ太郎"}, {id:354, title:"三者三葉"}, {id:355, title:"うさかめ"}, {id:356, title:"マギ シンドバッドの冒険"}, {id:357, title:"Re:ゼロから始める異世界生活"}, {id:358, title:"うしおととら(第3クール)"}, {id:359, title:"ワガママハイスペック"}, {id:360, title:"ジョジョの奇妙な冒険 ダイヤモンドは砕けない"}, {id:361, title:"テラフォーマーズ リベンジ"}, {id:362, title:"プリパラ(3rdシーズン)"}, {id:363, title:"エンドライド"}, {id:364, title:"ビッグオーダー"}} –GET methodのREST APIを呼ぶ on callRestGETAPIAndParseResults(aURL) –Request set aRequest to current application’s NSMutableURLRequest’s requestWithURL:(current application’s |NSURL|’s URLWithString:aURL) aRequest’s setHTTPMethod:"GET" aRequest’s setCachePolicy:(current application’s NSURLRequestReloadIgnoringLocalCacheData) aRequest’s setHTTPShouldHandleCookies:false aRequest’s setTimeoutInterval:60 –CALL REST API set aRes to current application’s NSURLConnection’s sendSynchronousRequest:aRequest returningResponse:(reference) |error|:(missing value) –Parse Results set resList to aRes as list set bRes to contents of (first item of resList) set resStr to current application’s NSString’s alloc()’s initWithData:bRes encoding:(current application’s NSUTF8StringEncoding) set jsonString to current application’s NSString’s stringWithString:resStr set jsonData to jsonString’s dataUsingEncoding:(current application’s NSUTF8StringEncoding) set aJsonDict to current application’s NSJSONSerialization’s JSONObjectWithData:jsonData options:0 |error|:(missing value) –Get Response Code set dRes to contents of second item of resList set resCode to (dRes’s statusCode()) as list of string or string –as anything –Get Response Header set resHeaders to (dRes’s allHeaderFields()) as list of string or string –as anything return {json:aJsonDict, responseCode:resCode, responseHeader:resHeaders} end callRestGETAPIAndParseResults |
More from my site
(Visited 19 times, 1 visits today)