Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created January 13, 2016 00:09
Show Gist options
  • Save anonymous/7364ab24072d3ee947d2 to your computer and use it in GitHub Desktop.
Save anonymous/7364ab24072d3ee947d2 to your computer and use it in GitHub Desktop.
#for Errno::ENOENT at /
#No such file or directory - ["https://scontent.xx.fbcdn.net/hprofile-xpa1/v/t1.0-1/p720x720/12096589_1495421344087950_7262794375923311339_n.jpg?oh=e30bafeb3343f37e1ff4b043a1d9e40a&oe=570956A5"]
#file: open-uri.rb location: initialize line: 35
@graph = Koala::Facebook::API.new(session['access_token'])
idofme = @graph.get_object("me") { |data| data['id'] }
#produces Errno::ENOENT error
imgofme = "http://graph.facebook.com/#{idofme}/picture?width=500"
httpc = HTTPClient.new
resp = httpc.get(imgofme)
imgofme2= resp.header['Location'].to_s
download = open(imgofme2)
IO.copy_stream(download, './temp.png')
#but this works
#imgofme3="https://scontent.xx.fbcdn.net/hprofile-xpa1/v/t1.0-1/p720x720/12096589_1495421344087950_7262794375923311339_n.jpg?oh=e30bafeb3343f37e1ff4b043a1d9e40a&oe=570956A5"
#download = open(imgofme3)
#IO.copy_stream(download, './temp.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment