0
나는 웹 라디오루비와 함께 서버에서 json 파일 반환을 처리하는 방법은 무엇입니까?
require 'open-uri'
rquiire 'json'
songlist=open('http://douban.fm/j/mine/playlist?type=n&channel=0')
##this will return a json file:
##{"r":0,"song" [{"album":"\/subject\/25863639\/","picture":"http:\/\/img5.douban.com\/mpic\/s27256956.jpg","ssid":"7656","artist":"Carousel Kings","url":"http:\/\/mr3.douban.com\/201404122019\/660a1b4494a255e0333dfdc9ffadcf08\/view\/song\/small\/p2055547.mp3","company":"Not On Label","title":"Silence","rating_avg":3.73866,"length":194,"subtype":"","public_time":"2014","sid":"2055547","aid":"25863639","sha256":"ebf027adfaf9882118456941a774eeb509c29c4c278f55f587ba2faaa858a49d","kbps":"64","albumtitle":"Unity","like":false}]
나는이 song[0]['url'], song[0]['title'],song[0]['album']
같은 정보를 얻기 위해 원하는 URL로 지적하여 곡을 연주하기 위해 터미널에 smplayer
를 사용하여 JSON 파일 반환이있다.
어떻게하면 루비로 할 수 있습니까?
감사합니다.