#!/usr/bin/env ruby require 'json' require 'net/http' require 'sanitize' require 'cgi' resp = Net::HTTP.get(URI("http://a.4cdn.org/mlp/thread/#{ARGV[0]}.json")) json = JSON.parse(resp) subject = json["posts"][0]["sub"] comments = json["posts"].map{|x| x["com"]} total_size = comments.size comments.map!{|comment| Sanitize.fragment(comment, Sanitize::Config::RESTRICTED)} comments.map!{|x| CGI.unescapeHTML(x)} comments.keep_if do |comment|   comment.length < 40 end puts "I found #{comments.count} useless fucking posts in ##{ARGV[0]} (#{subject})" puts "That's out of #{total_size} posts." puts "An astounding #{(comments.count.to_f/total_size)*100} percent. Jesus." puts "They were:" puts comments.join("\n~\n")