VeeHD Native HTML5 Video Player

Watch videos on VeeHD without the need for flashplayer

  1. // ==UserScript==
  2. // @name VeeHD Native HTML5 Video Player
  3. // @namespace stoisch_bauer
  4. // @version 0.3
  5. // @description Watch videos on VeeHD without the need for flashplayer
  6. // @author stoisch
  7. // @require https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349
  8. // @match http://veehd.com/*
  9. // ==/UserScript==
  10. /* jshint -W097 */
  11. 'use strict';
  12.  
  13. // Initiate Download
  14. document.querySelector('div[class="uv"]').click();
  15. // Wait on iframe...
  16. waitForKeyElements ("iframe[src*='/vpi']", run);
  17. function run() {
  18.  
  19. // Grab link from iframe
  20. var src = document.getElementById('playeriframe').contentDocument.body.innerHTML.match(/href=\W(.*?.mp4)\W>/)[1];
  21.  
  22. // Create html5 player
  23. var html5_video = document.createElement("VIDEO");
  24. html5_video.setAttribute("src",src);
  25. html5_video.setAttribute("width", "970");
  26. html5_video.setAttribute("height", "665");
  27. html5_video.setAttribute("controls", "controls");
  28. // Find and replace frame
  29. document.getElementById("p").appendChild(html5_video);
  30. var videoHolderElement = document.querySelector('#p');
  31. videoHolderElement.parentElement.replaceChild(html5_video, videoHolderElement);
  32.  
  33. console.log("Replaced :)");
  34. }