您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
On youtube click the download link to download youtube video.
当前为
- // ==UserScript==
- // @name YouTube Download
- // @namespace http://your.homepage/
- // @version 3.9
- // @description On youtube click the download link to download youtube video.
- // @author Henry Harris
- // @match https://www.youtube.com/*
- // @match http://9xbuddy.com/*
- // @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--------------------------------------------------------------
- var beforestop = false;
- setInterval(function(){
- if(window.location.href.indexOf("you") > -1) {
- if ($('#watch7-headline').length > 0) {
- if ($('#downloadlnk').length > 0) {
- } else {
- if ($('.html5-player-chrome').length > 0) {
- if ($('#vidctrls').length > 0) {
- } else{
- document.querySelector('div.html5-player-chrome').id = 'vidctrls';
- var c = document.createElement('img');
- c.src = "http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Egypt_governorates_blank.png/597px-Egypt_governorates_blank.png";
- c.height = "30";
- c.width = "10";
- var b = document.createElement('img');
- b.src = "http://images.clipartpanda.com/square-clip-art-black-and-white-0999d59a768fa638a6f16f4a44299e29.png";
- b.height = "30";
- b.width = "30";
- b.title = "Download this video";
- b.onclick = function () {
- window.open("http://9xbuddy.com/download?url=" + document.URL)
- };
- document.getElementById("vidctrls").appendChild(c);
- document.getElementById("vidctrls").appendChild(b);
- }
- } else {
- var downdiv = document.createElement("div");
- downdiv.id = "downdiv";
- var a = document.createElement('a');
- var linkText = document.createTextNode("Download");
- a.appendChild(linkText);
- a.id = "downloadlnk";
- a.title = "Download this video";
- a.onclick = function () {
- window.open("http://9xbuddy.com/download?url=" + document.URL)
- };
- var br3 = document.createElement('br');
- document.getElementById("watch7-headline").appendChild(br3);
- var br4 = document.createElement('br');
- document.getElementById("watch7-headline").appendChild(br4);
- var d = document.createElement('a');
- var linkText = document.createTextNode("Options");
- d.appendChild(linkText);
- d.id = "optionlnk";
- d.title = "Options";
- d.onclick = function () {
- var e = document.body;
- e.parentNode.removeChild(e);
- var body = document.createElement('body');
- document.getElementsByTagName('html')[0].appendChild(body);
- var chk1 = document.createElement('input');
- chk1.type = "checkbox";
- chk1.id = "chk1"
- document.getElementsByTagName('body')[0].appendChild(chk1);
- var label = document.createElement('label')
- label.htmlFor = "chk1";
- label.appendChild(document.createTextNode('Auto HD'));
- document.getElementsByTagName('body')[0].appendChild(label);
- var br = document.createElement('br');
- document.getElementsByTagName('body')[0].appendChild(br);
- var br2 = document.createElement('br');
- document.getElementsByTagName('body')[0].appendChild(br2);
- var appbtn = document.createElement('input');
- appbtn.type = "button";
- appbtn.value = "Apply"
- appbtn.onclick = function () {
- if (chk1.checked == true) {
- document.cookie =
- 'autohd=test; expires=Fri, 3 Aug 2050 20:47:11 UTC; path=/'
- } else {
- document.cookie = 'autohd=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/'
- }
- location.reload();
- }
- document.getElementsByTagName('body')[0].appendChild(appbtn);
- if (document.cookie.indexOf('autohd=')== -1) {
- chk1.checked = false;
- } else {
- chk1.checked = true;
- }
- };
- //document.body.appendChild(a);
- document.getElementById("watch7-headline").appendChild(downdiv);
- document.getElementById("downdiv").appendChild(a);
- document.getElementById("downdiv").appendChild(br3);
- document.getElementById("downdiv").appendChild(br4);
- document.getElementById("downdiv").appendChild(d);
- document.getElementById("downloadlnk").style.fontSize = "x-large";
- document.getElementById("optionlnk").style.fontSize = "x-large";
- var br1 = document.createElement('br');
- document.getElementById("watch7-headline").appendChild(br1);
- var br2 = document.createElement('br');
- document.getElementById("watch7-headline").appendChild(br2);
- }
- }
- }
- }
- if (document.cookie.indexOf('autohd=')== -1) {
- //no cookie
- } else {
- if (beforestop == false) {
- var myNode = document.getElementById("movie_player");
- while (myNode.firstChild) {
- myNode.removeChild(myNode.firstChild);
- beforestop = true;
- }
- var url = document.URL;
- url = url.substring(0, url.length - 8);
- var vidid = url.substring(url.indexOf('=')+1);
- var player = document.createElement('iframe');
- player.id = "player1";
- player.width = "1920";
- player.height = "1080";
- player.src = "https://www.youtube.com/embed/" + vidid + "?rel=0&autoplay=1&VQ=HD720";
- player.frameborder = "0";
- document.getElementById("movie_player").appendChild(player);
- document.getElementById("player1").setAttribute("allowfullscreen", "true");
- setTimeout(function(){
- document.getElementById("player1").width = "855";
- document.getElementById("player1").height = "480";
- }, 7000);
- }
- var url = document.URL;
- var idtest = url.substring(url.indexOf('=')+1);
- alert(vidid);
- if (idtest === vidid){
- } else {
- }
- }
- }, 2000);
- setInterval(function(){
- if(window.location.href.indexOf("you") > -1) {
- if(window.location.href.indexOf("embed") > -1) {
- } else {
- if(window.location.href.indexOf("reldone") > -1) {
- } else {
- window.location.assign(document.URL + "#reldone");
- location.reload();
- }
- }
- }
- }, 4000);
- // --------------------------RUNS ON KEEPVID TO DOWNLOAD VIDEO--------------------------------------------
- if(window.location.href.indexOf("buddy") > -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();
- $(iDiv).css({
- position: 'fixed',
- top: 0,
- right: 0,
- bottom: 0,
- left: 0,
- zIndex: 999
- });*/
- //if(!$('#javaUserWarning').is(':visible')) {
- setInterval(function(){
- if ($(".download-link-list")[0]){
- var els = document.getElementsByClassName('download-link-download lbcolor');
- var element = $('.download-about-section li');
- var zali = element[1]
- var zalitext = zali.innerHTML
- if (zalitext.match("VEVO")) {
- var li = els[1]
- li.id = 'dwnload';
- var t = $('#dwnload a').attr('href');
- } else {
- var li = els[2]
- li.id = 'dwnload';
- var t = $('#dwnload a').attr('href');
- }
- window.location = t
- setTimeout(function(){
- window.close();
- }, 2000);
- } else {
- //alert("test");
- }
- }, 3000);
- //document.getElementById("checkboxDisableJava1").checked = true;
- // } 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);
- //}
- //});