page = HTTParty.get("https://api.4chan.org/b/0.json").body
threads = JSON.parse(page)
count = 0
unless threads.nil?
threads['threads'].each do
count = count + 1
end
end
if count > 0
say "You have #{count} new threads."
unless threads['posts'].nil?
threads['posts'].each do |x|
say x['com']
end
end
end
if count == 0
say "You have no new threads."
end
出于某种原因,它说帖子是空的,但我猜线程从来不是....我不确定出了什么问题,它在 facebook 插件上为我做同样的事情,但昨天有效,现在什么都没有。难道我做错了什么?