Created
March 8, 2018 22:28
-
-
Save Qsick/485280023e6eca48e3c9db32c859c38d to your computer and use it in GitHub Desktop.
Q Rainforest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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