NHK çªçµè¡¨ API ã触ãçºã® Ruby ã¯ã©ã¤ã¢ã³ãä½ã£ã
NHK çªçµè¡¨ API ãå ¬éãããã®ã§ Ruby ã® API ã©ã¤ãã©ãªãä½ã£ã
ã¤ã³ã¹ãã¼ã«
ä¸è¨ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«åºæ¥ã
gem install nhk_program
使ãæ¹
ãããªæãã§ä½¿ãã
client = NHKProgram.new(api_key: 'YOUR_API_KEY') # ææ¥ã®NHKç·å1ã®çªçµè¡¨åå¾ data = client.list('130', 'g1', Date.today + 1) # éãæ¸ãæ¹ # data = client.list('æ±äº¬', 'NHKç·åï¼', :tomorrow) data.list.g1.each do |program| # ä½ããã end # ææ¥ã®NHKç·å1ã®ã¢ãã¡ã®çªçµè¡¨åå¾ data = client.genre('130', 'g1', '0700', Date.today + 1) # éãæ¸ãæ¹ # data = client.genre('æ±äº¬', 'NHKç·åï¼', 'ã¢ãã¡ï¼ç¹æ®(å½å ã¢ãã¡)', :tomorrow) data.list.g1.each do |program| # ä½ããã end # ã¿ããªã®ããã®çªçµè©³ç´°åå¾ data = client.info('130', 'e1', '2014020700918') # éãæ¸ãæ¹ # data = client.info('æ±äº¬', 'NHKEãã¬ï¼', '2014020700918') program = data.list.e1.first # ä½ããã # ä»NHKç·å1ã§ãã£ã¦ãçªçµè¡¨åå¾ data = client.now('130', 'g1') # éãæ¸ãæ¹ # data = client.now('æ±äº¬', 'NHKç·åï¼') data.nowonair_list.g1.following.each do |program| # ä½ããã end
ãã®ä»
æ·±å¤ã®ãã³ã·ã§ã³ã§ä¸æ°ã«ã³ã¼ãæ¸ãããã©ä»ã®ã¨ããèªåã§ä½¿ãäºå®ããªã
æ¯éçãããæ´»ç¨ãã ãã