YouTube Download

On youtube press F2 to download the current video.

当前为 2015-04-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         YouTube Download
// @namespace    http://your.homepage/
// @version      2.4
// @description  On youtube press F2 to download the current video.
// @author       Henry Harris
// @match        https://www.youtube.com/*
// @match        http://catchvideo.net/*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @run-at document-end
// ==/UserScript==





$(document).ready ( function(){
// -----------------------Runs on YOUTUBE--------------------------------------------------------------	   
	if(window.location.href.indexOf("you") > -1) {
        if ($('#section-list').length > 0) {
    		alert('Press F2 while watching a video to download it.');
    	}
	}
// --------------------------RUNS ON KEEPVID TO DOWNLOAD VIDEO--------------------------------------------    
    if(window.location.href.indexOf("catch") > -1) {
    //var iDiv = document.createElement('div');

        //iDiv.id = 'block';
        //iDiv.className = 'block';
        //document.getElementsByTagName('body')[0].appendChild(iDiv);
        //iDiv.height = window.height();
        //iDiv.width = window.width();
        //$( "#block" ).css("height", "100%");
        //$( "#block" ).css("width", "100%");
        //$( "#block" ).css("z-index", "100");
        //$( "#block" ).css("position", "fixed");
        if(!$('#javaUserWarning').is(':visible')) {
            
            
     //document.getElementById("checkboxDisableJava1").checked = true;
        
    //var url = document.URL;
	//var hash = url.substring(url.indexOf('?')+1);
        
   // var textbox = document.getElementById("home_search_q");
    
   // textbox.value = hash; 
    
    //$('#home_search_submit').click();
    
    setTimeout(function(){
    
    //$("#grab1").click();
    
        //var href = $( "a span:first-child" ).attr('href');
        //var firstspan = $('a.btn green:first');
        //var href = $( "#firstspan" ).attr('href');
        var els = document.getElementsByClassName('btn green');
        //alert("JS: " + els[0].innerHTML); // hello1
        var href = els[0].href
        
        window.location = href
        
        
        
        setTimeout(function(){
    
            window.close();
    
            
       }, 2000);
    }, 14000);

        
            } else {
                alert("Please check disable java applet and retry.");
        }
}
});

// -----------------------Runs on YOUTUBE--------------------------------------------------------------
$(document).keydown(function (e) {
    if (e.keyCode == 113) {
        //window.open("http://keepvid.com/?url=" + document.URL)
        
        var a = document.createElement("a");
    a.href = "http://catchvideo.net/?url=" + document.URL;
    var evt = document.createEvent("MouseEvents");    
    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null);
    a.dispatchEvent(evt);
    }
});