您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Show the star rating of a YouTube video
// ==UserScript== // @name View Star Rating // @namespace http://tampermonkey.net/ // @version 0.1 // @description Show the star rating of a YouTube video // @author DeltAndy // @match *://www.youtube.com/watch* // @run-at document-idle // @grant none // ==/UserScript== function wait(ms) { return new Promise((resolve, reject) => { setTimeout(() => { resolve(ms) }, ms ) }) } (async function() { 'use strict'; await wait(2500) document.querySelector('#dot').outerHTML = document.querySelector('#dot').outerHTML + '<span class="style-scope ytd-video-primary-info-renderer" id="rating">Fetching Star Rating...</span>' + document.querySelector('#dot').outerHTML document.querySelector('#rating').innerHTML = JSON.parse(document.evaluate('//script[contains(., \'var ytInitialPlayerResponse\')]', document).iterateNext() .innerHTML.split('= ')[1].split(';var')[0]) .videoDetails.averageRating .toFixed(2) + " stars" })();