NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Ya YouTube search // @namespace http://tampermonkey.net/ // @version 0.2 // @description Search videos in YouTube (from Yandex page). // @author E11ipS0iD // @match https://yandex.ru/* // @license MIT // @grant none // ==/UserScript== (function () { 'use strict'; setTimeout(function () { var btn = document.getElementsByClassName("service_name_video")[0]; if (btn !== undefined) { btn.innerHTML = '<a id="ytFromYa" class="service__url link link_theme_normal"><span class="service__name">YouTube</span></a>'; btn.onclick = function () { console.log('Open YouTube'); var link = document.getElementsByClassName('input__control')[0].value; link = encodeURI(link); document.location.href = 'https://www.youtube.com/results?search_query=' + link; }; return false; } var video = document.getElementsByClassName("VideoPlayerMetaInfo-SourceTextLine")[0]; if (video !== undefined && video.innerHTML == '<b>YouTube</b>') { console.log('YouTube player - founded'); document.location.href = document.getElementsByClassName("LinkWrapper")[0].href; return false; } }, 200); })();