Created
August 31, 2023 14:38
-
-
Save Hamada92/e65dac0fd35eb6bb377de4b43968d997 to your computer and use it in GitHub Desktop.
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
require "uri" | |
require "json" | |
require "net/http" | |
def recursive_fetch(url) | |
url = URI(url) | |
https = Net::HTTP.new(url.host, url.port) | |
https.use_ssl = true | |
request = Net::HTTP::Get.new(url) | |
request["Content-Type"] = "application/json" | |
response = https.request(request) | |
result = JSON.parse(response.read_body) | |
return result unless result["follow"] | |
new_url = result["follow"] | |
puts "following new linke #{new_url}" | |
return recursive_fetch(new_url.gsub("challenge", "challenge.json")) | |
end | |
recursive_fetch("https://www.letsrevolutionizetesting.com/challenge.json?id=756775492") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment