読者です 読者をやめる 読者になる 読者になる

音泉のAPI

インターネットラジオ好きですか?
僕めっちゃ好きです。声優系のだと「荒川FM」とか「日常のラヂオ」、素人のだと「タイムマシン部」好きでした。
声優系のだと音泉とか響ってサイトでラジオ聞くこと多いと思います。
今回は音泉のWeb APIっぽいものを見てみました。

配信中の番組名一覧

http://www.onsen.ag/api/shownMovie/shownMovie.json
配信中の番組名を返すAPI
形式はjson

{"result":["niconama_charlotte","mhr3","hanayume","azbear","tsukinone","nairon","gatcha","kamo","shingeki","naderadi","hmx3","corpse","lump","yp_radio","niconama_re-kan","i96","arslan_anime","gg","anime","nwing","poli","glory","grisaia2","fmc2","lovelive2","nana","rumra","priya2","sara_kuru","home","mhr2","pleiades","sakigake","hiroradi","karucha","aiming2","radio_alcot","ensemble_stars","kakazu","diaace","gachi","501st","otome4","bancha","ozawa","sidonia","zenbu","shokugeki2","bemasu","niconama_usagi2","pcgame","yryr","godeater","niconama_seiheki","seraph","axl6","storm2","uta","niconama_sb69a","selector","jojo","seiheki","niconama_pp24","nono","monmusu","dai-gyakuten","sb69a","hetalira","niconama_zenbu","niconama_0701_13shiki","niconama_usagi","prison","charlotte","0823niconama_selector","trident","0823niconama_selector2","niconama_euphonium","re-kan","tadaradio","yuyuyu","121","niconama_yuyuyu","ft","ff","plc","kurigimu","niconama_soruraru2","niconama_seiheki2","soruraru","niconama_gachi","overlord","niconama_sara_kuru","niconama_gachi2","niconama_soruraru","kekkai","lumi","niconama_mabinogi","norn","usagi","dmm","uta3","niconama_pleiades","niconama_pleiades2","ninja","euphonium","goes","shokugeki"]}

番組情報取得

http://www.onsen.ag/data/api/getMovieInfo/{番組名} 各番組の情報を取得。{番組名}の部分はhttp://www.onsen.ag/api/shownMovie/shownMovie.jsonで取得した番組名が入ります。
一応jsonで帰ってくるのですがcallback()の部分が邪魔かもしれませんので、いい感じに処理してください。

json部分をパースするとこうなる。例としてゆるゆりのラジオ(http://www.onsen.ag/data/api/getMovieInfo/yryr)を見てみた。

{"type"=>"sound",
 "thumbnailPath"=>"/program/yryr/image/114_pgi01_m.jpg",
 "moviePath"=>
  {"pc"=>"http://onsen.b-ch.com/radio/yryr150717VexC.mp3",
   "iPhone"=>"http://onsen.b-ch.com/radio/yryr150717VexC.mp3",
   "Android"=>"http://onsen.b-ch.com/radio/yryr150717VexC.mp3"},
 "title"=>"ゆりゆららららゆるゆり放送室",
 "personality"=>"三上枝織(赤座あかり) / 大坪由佳(歳納京子 役) / 津田美波(船見結衣 役) / 大久保瑠美(吉川ちなつ 役)",
 "guest"=>"",
 "update"=>"2015.7.17",
 "count"=>"212",
 "schedule"=>"毎週金曜22時30分更新",
 "optionText"=>"",
 "mail"=>"",
 "copyright"=>"©2015 なもり/一迅社・七森中ごらく部",
 "url"=>"yryr",
 "link"=>
  [{"imagePath"=>"/program/yryr/image/114_pgl01.jpg",
    "url"=>"http://www.tohogakuen.ac.jp/yuruyuri/"},
   {"imagePath"=>"/program/yryr/image/114_pgl02.jpg",
    "url"=>"http://yuruyuri.com/"},
   {"imagePath"=>"/program/yryr/image/114_pgl03.jpg",
    "url"=>"http://www.b-ch.com/"}],
 "recommendGoods"=>[],
 "recommendMovie"=>
  [{"imagePath"=>"/program/bemasu/image/111_pgi01_b.jpg",
    "url"=>"/program/bemasu/"}],
 "cm"=>[],
 "allowExpand"=>"false"}

moviePathの中身を見たらmp3ファイルのURLがわかるんで、まぁゴニョゴニョ…できます
このファイルは今週分の配信が公開終了後も残ってるっぽいので、聞く暇が無いけど聞き逃したくないって人はURLだけでも保存しておくといいかもしれませんね
ゲストの有無をguest、第何回の配信かもcountの部分でわかるので便利。

まぁ配信開始されたかの情報だけならRSSなり公式Twitterで十分なですけどね。