// ==UserScript== // @name RARBG Add YouTube Trailer Link // @namespace http://tampermonkey.net/ // @version 1 // @description Adds youtube trailer link to RARBG (if is missing) // @author https://github.com/michalani // @match https://rarbgmirror.com/torrent/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; var arrayOfHeaders = document.querySelectorAll(".header2") var notFoundTrailer = true function isTrailer(value) { if(value.innerHTML === 'Trailer:') { notFoundTrailer = false } } arrayOfHeaders.forEach(isTrailer); if(notFoundTrailer){ //find torrent title var torrentTitle = document.getElementsByClassName("lista")[6].innerText.replace(/\./g,' ').substring(1); //remove last 2 words and a trailing space torrentTitle = torrentTitle.substring(0, torrentTitle.lastIndexOf(" ")); torrentTitle = torrentTitle.substring(0, torrentTitle.lastIndexOf(" ")); torrentTitle = torrentTitle.substring(0, torrentTitle.lastIndexOf(" ")); let ytlink = "https://www.youtube.com/results?search_query=" + torrentTitle + " trailer" //create a section similar to div var youtubeSection = document.createElement("tr"); youtubeSection.innerHTML = '