YouTube Download

(Requires Java!!!) On youtube press F2 to download the current video. If Java message pops up check the box to make the message not pop up next time.

目前為 2014-12-27 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name YouTube Download
  3. // @namespace http://your.homepage/
  4. // @version 2.3
  5. // @description (Requires Java!!!) On youtube press F2 to download the current video. If Java message pops up check the box to make the message not pop up next time.
  6. // @author Henry Harris
  7. // @match https://www.youtube.com/*
  8. // @match http://keepvid.com/*
  9. // @grant none
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14.  
  15.  
  16.  
  17.  
  18. $(document).ready ( function(){
  19. // -----------------------Runs on YOUTUBE--------------------------------------------------------------
  20. if(window.location.href.indexOf("you") > -1) {
  21. if ($('#section-list').length > 0) {
  22. alert('Press F2 while watching a video to download it.');
  23. }
  24. }
  25. // --------------------------RUNS ON KEEPVID TO DOWNLOAD VIDEO--------------------------------------------
  26. if(window.location.href.indexOf("keep") > -1) {
  27. setInterval(function(){
  28. if ($('#info').length > 0) {
  29. var divs = document.getElementsByTagName("a");
  30. for (var i = divs.length; i;) {
  31. var div = divs[--i];
  32. if (div.download.indexOf("Max") > -1) {
  33. div.click();
  34. }
  35. }
  36. setTimeout(function(){
  37. window.close();
  38. }, 1000);
  39. }
  40. }, 2000);
  41. }
  42. });
  43.  
  44. // -----------------------Runs on YOUTUBE--------------------------------------------------------------
  45. $(document).keydown(function (e) {
  46. if (e.keyCode == 113) {
  47. //window.open("http://keepvid.com/?url=" + document.URL)
  48. var a = document.createElement("a");
  49. a.href = "http://keepvid.com/?url=" + document.URL;
  50. var evt = document.createEvent("MouseEvents");
  51. evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null);
  52. a.dispatchEvent(evt);
  53. }
  54. });