Greasy Fork is available in English.

YouTube Video Info

Adds upload date and views to the YouTube video title


Установить этот скрипт?
  1. // ==UserScript==// @name YouTube Video Info// @version 0.32// @description Adds upload date and views to the YouTube video title// @author Phorz// @match https://www.youtube.com*// @license MIT// @grant none// @namespace http://tampermonkey.net/// ==/UserScript==// Wait for the page to loadwindow.addEventListener('load', function() {// Set the interval for checking if the element has changedsetInterval(function() {// Get the element with the ID "original-info"var originalInfoElement = document.getElementById('original-info');var infoElement = document.getElementsByClassName('style-scope ytd-watch-metadata').info;// Check if span element got setif(originalInfoElement.children[2].innerText != ""){// Get the video title elementvar videoTitleElement = document.getElementsByClassName('style-scope ytd-watch-metadata').title;// Check if the span element already existsif (document.getElementById('videoinfo') != null) {document.getElementById('videoinfo').remove();}// Click info expanddocument.getElementsByClassName('button style-scope ytd-text-inline-expander').expand.click();// Get the upload date and view count from the elementvar uploadDate = originalInfoElement.children[2].innerText;var viewCount = originalInfoElement.children[0].innerText;// Create the new span elementvar videoInfoSpan = document.createElement('span');videoInfoSpan.innerHTML = uploadDate + ' | ' + viewCount;videoInfoSpan.setAttribute('dir', 'auto');videoInfoSpan.setAttribute('class', 'style-scope yt-formatted-string');videoInfoSpan.setAttribute('style', 'color: #999999; font-size: 13px;');videoInfoSpan.setAttribute('id', 'videoinfo')// Add the new span element to the title elementvideoTitleElement.appendChild(videoInfoSpan);// Hide info collapsedocument.getElementsByClassName('button style-scope ytd-text-inline-expander').collapse.hidden = true;originalInfoElement.hidden = true;originalInfoElement.children[0].innerText = "";originalInfoElement.children[2].innerText = "";infoElement.hidden = true;infoElement.children[0].innerText = "";infoElement.children[2].innerText = "";}}, 1000); // Check every 10 seconds});