Instagram embed code from url (Rails)
<p>In my application, I would like to allow user introduce a url of instagram, and then automatically retrieve the embed code of it.</p>

<p>I found this reference:
<a href="https://www.instagram.com/developer/embedding/#oembed" rel="nofollow">https://www.instagram.com/developer/embedding/#oembed</a></p>

<p>When I try the given example (<a href="https://api.instagram.com/oembed?url=http://instagr.am/p/fA9uwTtkSN" rel="nofollow">https://api.instagram.com/oembed?url=http://instagr.am/p/fA9uwTtkSN</a>) in my Chrome browser, I get the json with the code I am looking for.</p>

<p>However, if I try this from the rails console:</p>

<pre><code>Net::HTTP.get_response(URI("https://api.instagram.com/oembed?url=http://instagr.am/p/fA9uwTtkSN"))
</code></pre>

<p>I get this:</p>

<pre><code>#&lt;Net::HTTPMovedPermanently 301 MOVED PERMANENTLY readbody=true&gt; 
</code></pre>

<p>I saw that instagram have a new API, but I don't want to make user authenticate from instagram. </p>

<p><strong>Is there a way to do it?</strong></p>