title: Getting YouTube URL for downloading video
body: <p>I am writing a Python script for downloading a YouTube video. I am sending a request to a certain YouTube URL and getting it's response. Now, I want to get the URL of that video so that I can download it. All the answers I have found are outdated. Where in the response is the video URL hidden? Or there is no way to get the video URL?</p>
  
  <pre><code>import urllib2
  import json
  f = open("video.txt","w")
  response = urllib2.urlopen("https://youtu.be/OulN7vTDq1I")
  f.write(response.read())
  </code></pre>
  
  <p>And I got something like this in embed part of response:</p>
  
  <pre><code>&lt;link rel="alternate" type="application/json+oembed" href="http://www.youtube.com/oembed?format=json&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOulN7vTDq1I" title="Badshah - DJ Waley Babu | feat Aastha Gill | Party Anthem Of 2015 | DJ Wale Babu"&gt;
    &lt;link rel="alternate" type="text/xml+oembed" href="http://www.youtube.com/oembed?format=xml&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOulN7vTDq1I" title="Badshah - DJ Waley Babu | feat Aastha Gill | Party Anthem Of 2015 | DJ Wale Babu"&gt;
  </code></pre>