Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube Download Online Video Converter
// ==UserScript==
// @name Youtube Download Online Video Converter
// @namespace https://www.onlinevideoconverter.com/
// @version 1.2.2
// @description This userscript assists OnlineVideoConverter to convert video links.
// @copyright 2017, OnlineVideoConverter.com
// @icon https://www.onlinevideoconverter.com/assets/images/ovc-icon.png
// @icon64 https://www.onlinevideoconverter.com/assets/images/ovc-icon64.png
// @homepage https://www.onlinevideoconverter.com/extension
// @downloadURL https://www.onlinevideoconverter.com/assets/javascript/ovc.user.js
// @match *://www.youtube.com/*
// @run-at document-end
// @grant GM_xmlhttpRequest
// ==/UserScript==
if("undefined" == typeof (onlinevideoconverter)) {
var onlinevideoconverter = {
currentMediaUrl: null,
currentId: null,
userUrl: 'https://www.onlinevideoconverter.com/video-converter?ref=addon&version=121',
getParam : function (document, variable){
var query = document.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
} return(false);
},
addButtons: function() {
var icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAXCAYAAAAV1F8QAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmO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slWE0pWZekSURqexmEKNNxl5Pm38FzjQhbuimlVzAFsN9NfKkQvr/YLMt+U5BD7EN/EZVqgjrCDSYpQY3c40Z58bjUcs+ae1Hkk76FQg/hTvfVNsR5wSAyohh7fj9x3WqW5XY6OfsB9X958jFJjjln/gFfkJuf/+jXLQAAAABJRU5ErkJggg==';
var onlinevideoconverterpath = onlinevideoconverter.userUrl + "&url=" + encodeURIComponent(document.URL);
var div_embed = null;
var spanclass="";
var buttonclass = "";
if(document.getElementById('watch-like-dislike-buttons')) {
var div_embed = document.getElementById('watch-like-dislike-buttons');
var buttonclass = "yt-uix-button yt-uix-button-text yt-uix-tooltip";
var spanclass="";
} else if(document.getElementById('watch-headline-user-info')) {
var div_embed = document.getElementById('watch-headline-user-info');
var buttonclass = "yt-uix-button yt-uix-button-default yt-uix-tooltip";
var spanclass="yt-uix-button-group";
} else if(document.getElementById('watch8-sentiment-actions')) {
var div_embed = document.getElementById('watch8-sentiment-actions');
var buttonclass = "yt-uix-button yt-uix-button-default yt-uix-tooltip";
var spanclass="yt-uix-button-group";
}
var target= '_blank';
if(div_embed) {
var tmp = div_embed.innerHTML;
div_embed.innerHTML = ' <span id="onlinevideoconverter" class="' + spanclass + '">';
div_embed.innerHTML += '<a href="' + onlinevideoconverterpath + '" target="' + target + '"><button class="start ' + buttonclass + '" type="button" title="Convert with OnlineVideoConverter.com"><img alt="" class="" style="" src="' + icon + '"></button></a>';
div_embed.innerHTML += '</span>';
div_embed.innerHTML += tmp;
document.querySelector('#convertButton').onclick = function() {
var e = document.getElementById("conversionFormat");
var strUser = e.options[e.selectedIndex].value;
window.open(onlinevideoconverterpath + "&format="+strUser);
};
}
},
onPageLoad : function() {
if(document.body && document.domain == 'www.youtube.com') {
setInterval(onlinevideoconverter.check, 1500);
onlinevideoconverter.check();
}
},
check: function() {
var ytplayer = unsafeWindow.ytplayer;
if(onlinevideoconverter.currentMediaUrl != document.URL && ytplayer && ytplayer.config && ytplayer.config.args && onlinevideoconverter.currentId != ytplayer.config.args.video_id) {
onlinevideoconverter.currentId = ytplayer.config.args.video_id;
onlinevideoconverter.currentMediaUrl = document.URL;
onlinevideoconverter.addButtons(document);
}
}
};
onlinevideoconverter.onPageLoad();
}
@iqiancheng

This comment has been minimized.

Copy link
Owner Author

@iqiancheng iqiancheng commented Sep 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment