Skip to content

Instantly share code, notes, and snippets.

@Qsick
Created March 8, 2018 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qsick/485280023e6eca48e3c9db32c859c38d to your computer and use it in GitHub Desktop.
Save Qsick/485280023e6eca48e3c9db32c859c38d to your computer and use it in GitHub Desktop.
Q Rainforest
#!/usr/bin/ruby
require 'net/https'
require 'json'
url = 'https://goo.gl/Qq0aFP'
while ( (res = Net::HTTP.get_response(URI(url))).code.to_i == 301 )
url = res['location']
end
url.sub!('challenge', 'challenge.json')
while ( res = Net::HTTP.get_response(URI(url)) )
json = JSON.parse(res.body)
if json.has_key? 'message'
break
else
url = json['follow'].sub('challenge', 'challenge.json')
end
end
puts json['message']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment