Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Add this to your .bashrc, anon

Name: Anonymous 2013-09-01 7:55

ruby faggotry.rb


#!/faggotry/binaries/ruby-for-wise-person
debug = ARGV[0]
requirements = ['net/http', 'json', 'Nokogiri'].map { |mod| require mod }
print "#{requirements} \n" if debug


board_array = JSON.parse(Net::HTTP.get(URI("http://api.4chan.org/boards.json")))["boards"].map { |board| board["board"] }
board = board_array[rand board_array.length];



url = "http://api.4chan.org/#;{board}/threads.json"
thread_url = "http://api.4chan.org/#;{board}/res/$NUMBER_PLACEHOLDER$.json"

print "Requesting info for /#{board}/: " + url + "\n" if debug

#Get all the thread numbers in the requested board
thread_numbers = JSON.parse(Net::HTTP.get(URI(url))).map { |page| page["threads"] }.flatten.map { |thread| thread["no"] }


print "\# of threads in /#{board}/: #{thread_numbers.length}\n" if debug

total_threads = thread_numbers.length
thread_number = thread_numbers[rand total_threads].to_s
now_thread_url = thread_url.gsub("$NUMBER_PLACEHOLDER$", thread_numbers[rand total_threads].to_s);
   
print "Requesting /#{board}/#{thread_number} by #{now_thread_url}\n" if debug
   
post_array = JSON.parse(Net::HTTP.get(URI(now_thread_url)))["posts"]

print "The wise man from /#{board}/ says:\n    #{Nokogiri::XML.fragment(post_array[rand post_array.length]["com"]).xpath('.//text()').map(&:text).reduce { |result, text| result.to_s + "\n    " + text}}\n"

Name: Anonymous 2013-09-01 8:18

I get it, if you add this to your bashrc it will take an hour to get you your shell. Epic ruse, bro xD

Name: Anonymous 2013-09-01 8:22

>>2
If you live in the boondocks, perhaps.

Name: Anonymous 2013-09-01 8:58

So this only works on the imageboards. Where is the JSON URL for the textboards?

Name: Anonymous 2013-09-01 9:07

Methinks there's no JSON feed for textboards.
https://github.com/4chan/4chan-API

Name: Anonymous 2013-09-01 9:46

back to the image boards then I suppose.

Name: Anonymous 2013-09-02 1:51

>>5
Nah ther is one, but I forgot to bookmark it, like:
https://dis.4chan.org/prog/subject.txt

Don't change these.
Name: Email:
Entire Thread Thread List