您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Include thumbnail in bunkrr video view page
// ==UserScript== // @name Bunkrr video show thumbnail // @namespace Violentmonkey Scripts // @version 0.3 // @description Include thumbnail in bunkrr video view page // @author walmart22 // @match https://*.bunkrr.su/* // @license MIT // @grant none // ==/UserScript== // Run immediately if ready otherwise queue up if (document.readyState !== 'loading') { insertThumbnail(); } else { document.addEventListener('DOMContentLoaded', insertThumbnail); } function insertThumbnail() { const videoExtension = ['mp4', 'm4v', 'mov', 'mkv']; const domain = 'bunkrr' const thumbDomain = 'bunkr' const url = window.location.href; let modifiedUrl = url; if (!videoExtension.some(ext => url.toLowerCase().includes(`.${ext}`))) { // If the url doesn't include the extension, build the url using the video src let video_url = document.querySelector('source').src.split('/').pop(); modifiedUrl = url.split('/').slice(0, -1).join('/') + '/' + video_url; } let downloadLink = Array.from(document.querySelectorAll("a")).find(el => el.textContent.trim().startsWith('Download')); let prefix = new URL(downloadLink.href).host.split('.')[0]; let thumbnailBase = modifiedUrl.replace(new RegExp(`\.(${videoExtension.join('|')})`, 'ig'), '.png') // Two options seen in the wild let thumbnail1 = thumbnailBase.replace(`//${domain}.su/v/`, `//i-${prefix}.${thumbDomain}.ru/thumbs/`); let thumbnail2 = thumbnailBase.replace(`//${domain}.su/v/`, `//${prefix}img.${thumbDomain}.ru/thumbs/`); if (thumbnail1.indexOf('i-media-files') !== -1) { thumbnail2 = thumbnail1.replace("i-media-files", "i"); } // If the first thumbnail fails to load, try the second one let onError = `this.onerror=null;this.src='${thumbnail2}';src="${thumbnail2}"` let template = document.createElement('template'); template.innerHTML = `<img src="${thumbnail1}" alt="img" loading="lazy" style="display: inline" onError="this.onerror=null;this.src='${thumbnail2}'">` let place = document.querySelector('#statsLink'); if (!place) { place = document.querySelector('body > main > section:nth-child(2) > div > div > div > div:nth-child(2) > div > a'); } place.parentElement.prepend(template.content); }