Last active
March 21, 2023 00:19
-
-
Save youtubetomp3converterapi/7814c235e8d143c331d70dedf9baf7f0 to your computer and use it in GitHub Desktop.
This allows All browser users to download and convert YouTube videos to mp3 (320) kbps files and also videos with a variety of high quality options 2160p (4k), 1440p (2k), 1080p (HD), 720p (HD), 480p, 360p, 144p etc. This video quality is supported for all available video formats (MP4, WEBM, 3GP). Then Visit https://www.youtube.com/new
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Vevioz Youtube Downloader | |
// @description This extension add a download tab button on any Youtube page and allows you to download MP3 & Video with just one click (1080,2K,4K,8K Ultra High Definition Supported). | |
// @icon https://assets.vevioz.com/addons/images/favicon.ico | |
// | |
// @author Vevioz Enterprise | |
// @namespace https://developers.vevioz.com | |
// | |
// @license GPLv3 - https://www.gnu.org/licenses/gpl-3.0.txt | |
// @copyright Copyright (C) 2022, by Developer.vevioz.com | |
// @include https://www.youtube.com/* | |
// @include https://www.youtube.com/* | |
// | |
// @version 7.6 | |
// | |
// @run-at document-end | |
// @unwrap | |
// ==/UserScript== | |
dwld_btn_onclick = function (){ | |
var path ='https://addons.vevioz.com/?id='+encodeURIComponent(getYT(window.location)); | |
window.open(path,'_blank'); | |
}; | |
getYT = function(url){ | |
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; | |
var match = String(url).match(regExp); | |
return (match&&match[7].length==11)? match[7] : false; | |
}; | |
getSpan = function(text, className) { | |
var _tn = document.createTextNode(text); | |
var span = document.createElement("span"); | |
span.className = className; | |
span.appendChild(_tn); | |
return span; | |
}; | |
var myAppInterface = { | |
init:function(){ | |
this.insertGlobalCSS(); | |
}, | |
addGlobalStyle: function(doc, css) { | |
if(document.querySelector('.easy-youtube-mp3-css'))return; | |
var head = doc.getElementsByTagName('head')[0]; | |
if (!head) {return; } | |
var style = doc.createElement('style'); | |
style.id = 'easy-youtube-mp3-css'; | |
style.type = 'text/css'; | |
if (style.styleSheet) { | |
style.styleSheet.cssText = css; | |
} else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
head.appendChild(style); | |
}, | |
insertGlobalCSS: function(){ | |
var css = function (){ | |
/*start | |
#downloadyoutubemp3.ytd-watch{padding-top:0px;overflow: auto;padding-bottom: 10px;margin-right:10px} | |
#downloadyoutubemp3 .dwld_btn{background-color: #f16310;border: #f16310;border-radius: 2px;color: #FFF;padding: 10px 16px; font-size: 1.4em;cursor:pointer;display:inline-block} | |
#downloadyoutubemp3 .dwld_btn:hover{background-color: #f16310} | |
@media (min-width: 657px){ytd-watch[theater] #downloadyoutubemp3.ytd-watch{margin-right:24px}} | |
end*/ | |
}.toString().replace("/*start",'').replace("end*/",'').slice(14,-1); | |
this.addGlobalStyle(document, css); | |
}, | |
}; | |
createButton = function() { | |
var obj = document.querySelector('#top-level-buttons-computed'); | |
if(obj !== null){ | |
// check if the button has already been created | |
var btnRow = document.getElementById('downloadyoutubemp3'); | |
if(btnRow === null){ | |
myAppInterface.init(); | |
var downloadyoutubemp3 = document.createElement("div"); | |
downloadyoutubemp3.id = "downloadyoutubemp3"; | |
downloadyoutubemp3.className = "style-scope ytd-watch"; | |
var dwld_btn = document.createElement("div"); | |
dwld_btn.className = "style-scope dwld_btn"; | |
dwld_btn.appendChild(getSpan("DOWNLOAD")); | |
dwld_btn.onclick = dwld_btn_onclick; | |
obj.parentNode.insertBefore(downloadyoutubemp3, obj); | |
downloadyoutubemp3.appendChild(dwld_btn); | |
} | |
} | |
}; | |
// yt does make use of some bogus AJAX functionality which breaks pagemod | |
// we have to check in intervals if the document has been replaced by yt to | |
// recreate the button if needed. | |
var intervalCheck = setInterval(function(){ createButton();}, 250); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment