3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

音泉のWebAPIを使って番組名の一覧や番組情報を取得する

Posted at

音泉とは

インターネットラジオの配信を行っているWebサイトです。最新の配信回は、無料で視聴することが出来ます。
http://www.onsen.ag/

音泉のWebAPI

音泉にはWebAPIが存在しています。例えば、
http://www.onsen.ag/api/shownMovie/shownMovie.json
にアクセスすると、番組名の一覧をJSON形式で取得することができます。
rubyを使えば、以下のようにして番組名が取得出来ます。

get_onsen_name.rb
# !/usr/bin/env ruby

require 'open-uri'
require 'json'

def radio_program_name
  url = 'http://www.onsen.ag/api/shownMovie/shownMovie.json'
  name = ""
  open(url) do |file|
    name += file.read
  end
  JSON.parse(name)
end

name = radio_program_name

ここで取得できた番組名を使って、番組の情報を取得できるWebAPIもあります。
http://www.onsen.ag/data/api/getMovieInfo/
↑のURLの後ろに、JSON形式で取得した番組名をつけてアクセスすると、番組情報が取得できます。例えば、
http://www.onsen.ag/data/api/getMovieInfo/home
にアクセスすると、「ほめられてのびるらじお(通称、ほめらじ)」の番組情報を取得することができます。

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?