$label_url = "http://www.blogger.com/feeds/#{$userID}/blogs/#{$blogID}?alt=json-in-script&callback=listLabels"
class BlogLabels
def get_labels
result = URLFetch.get($label_url)
result_headless = result.gsub("listLabels(",'')
pure_result = result_headless.gsub(");",'')
JSON.parse(pure_result)['entry']['category']
end
end
@labels = BlogLabels.new
@labels.get_labels.each do |cont|
puts cont['term']
end
JSON was not works.
Change to use YAML.
response = URLFetch.get($label_url)
result = response.to_s
result_headless = result.gsub("listLabels(",'')
pure_result = result_headless.gsub(");",'')
json_to_yaml = YAML::load(pure_result)['entry']['category']
0 件のコメント:
コメントを投稿