Get redirect of a URL in Ruby

This was already answered correctly, but there’s a much simpler way:

res = Net::HTTP.get_response(URI('https://graph.facebook.com/1489686594/picture'))
res['location']

Leave a Comment