title: Downloading Flowplayer Videos With Authentication
body: <p>My University has uploaded lecture videos on their website. To access them, certain credentials have to be entered which I obviously possess. They are using a simple <a href="https://en.wikipedia.org/wiki/Apache_HTTP_Server" rel="nofollow">Apache Server</a>. Videos are embedded as <a href="https://flowplayer.org/" rel="nofollow"><code>Flowplayer</code></a> and they do not provide a means of downloading them. The <code>html</code> source of the video page is roughly the following:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Show video&lt;/title&gt;
  &lt;script type="text/javascript" src="https://www.example.com/videos/javascript/jquery.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="https://www.example.com/videos/css/mta.css?timestamp=1440967823" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script src="javascript/flowplayer/flowplayer-3.2.12.min.js"&gt;&lt;/script&gt;
  &lt;div style="width: 256px; height: 256px; background-color: #ff00ff" id="player"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  $f("player", "javascript/flowplayer/flowplayer-3.2.16.swf", {
      onLoad: function(){
          $.get("https://www.example.com/videos/prepareVideo",
                  {videoID :'fae98609a52e6d252606248d1339e919'},
                  function(data){
                                          $f("player").play(data.url);
                                          $('#player').width(data.width);
                                          $('#player').height(data.height);
                                          $('#title').html("Playing "+data.description);
                  }
             );
      }
  }
  );
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I tried observing the network tab in the Chrome developer tools and it revealed the location of the video due to the highest network consumption. It is called <code>video.mp4</code>.</p>
  
  <p>Opening its url in the browser returns a page with the following contents:</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;404 File not found, no session data found&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Why does it not find the file? What's the deal with the session data? I authenticated myself. Is there a way to get the video and download it programmatically via its direct download link though assuming one can supply the credentials?</p>