您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
全网全平台视频截屏截图截取视频助手,支持在B站哔哩哔哩、优酷、爱奇艺、腾讯视频、乐视、芒果TV、搜狐视频、AcFun、Netflix、油管、TED、优.土、QQ、西瓜视频、A站、PPTV、咪咕视频、新浪、微博、网易[娱乐、云课堂、新闻]、搜狐、风行、百度云视频、抖音、快手、YouTube、小红书、秒拍、微视、皮皮虾、土豆、迅雷看看等;直播:twitch、斗鱼、YY、虎牙、龙珠、战旗、映客等主流视频网站上进行快速视频截图。无论你是在观看影视剧、综艺节目还是在线课程,这款插件都能轻松帮助你截取高质量的屏幕图像,提升你的观影体验。安装后,一键截图,轻松保存精彩瞬间,支持自定义截图快捷键,操作简单,便捷实用!
// ==UserScript== // @name 全网全平台视频截屏截图截取视频助手 - 支持B站哔哩哔哩、优酷、爱奇艺、腾讯视频、乐视、芒果TV、搜狐视频、AcFun、Netflix、油管、TED、优.土、QQ、西瓜视频、A站、PPTV、视频网站 // @namespace http://tampermonkey.net/ // @version 2024-08-15 // @description 全网全平台视频截屏截图截取视频助手,支持在B站哔哩哔哩、优酷、爱奇艺、腾讯视频、乐视、芒果TV、搜狐视频、AcFun、Netflix、油管、TED、优.土、QQ、西瓜视频、A站、PPTV、咪咕视频、新浪、微博、网易[娱乐、云课堂、新闻]、搜狐、风行、百度云视频、抖音、快手、YouTube、小红书、秒拍、微视、皮皮虾、土豆、迅雷看看等;直播:twitch、斗鱼、YY、虎牙、龙珠、战旗、映客等主流视频网站上进行快速视频截图。无论你是在观看影视剧、综艺节目还是在线课程,这款插件都能轻松帮助你截取高质量的屏幕图像,提升你的观影体验。安装后,一键截图,轻松保存精彩瞬间,支持自定义截图快捷键,操作简单,便捷实用! // @author chenghengsheng // @match *://*.bilibili.com/* // @match *://*.youku.com/* // @match *://*.iqiyi.com/* // @match *://*.v.qq.com/* // @match *://*.le.com/* // @match *://*.mgtv.com/* // @match *://*.sohu.com/* // @match *://*.acfun.cn/* // @match *://*.netflix.com/* // @match *://*.youtube.com/* // @match *://*.ted.com/* // @match *://*.youku.com/* // @match *://*.xigua.com/* // @match *://*.acfun.cn/* // @match *://*.pptv.com/* // @match *://*.mgtv.com/* // @match *://*.miguvideo.com/* // @match *://*.weibo.com/* // @match *://*.163.com/* // @match *://*.sohu.com/* // @match *://*.feng.com/* // @match *://*.pan.baidu.com/* // @match *://*.twitch.tv/* // @match *://*.douyu.com/* // @match *://*.yy.com/* // @match *://*.huya.com/* // @match *://*.longzhu.com/* // @match *://*.zhanqi.tv/* // @match *://*.douyin.com/* // @match *://*.kuaishou.com/* // @match *://*.xiaohongshu.com/* // @match *://*.miaopai.com/* // @match *://*.weishi.com/* // @match *://*.pipix.com/* // @match *://*.tudou.com/* // @match *://*.xunlei.com/* // @match *://*/* // @grant none // @icon https://chuizi.shop/files/video-screenshot-icon.png // @license MIT // ==/UserScript== (function () { 'use strict'; console.log("你好,我是Hansen。"); // @match *://*/* var offsetX, offsetY, isDragging = false; var canScreenshot = true; function DoScreenshot() { // console.log("click - 0"); if (!canScreenshot) { // console.log("click - 1"); return } var video = document.querySelector("video"); if (video) { var canvas = document.createElement("canvas"); var ctx = canvas.getContext("2d"); canvas.width = video.videoWidth; canvas.height = video.videoHeight; ctx.drawImage(video, 0, 0, canvas.width, canvas.height); var dataURL = canvas.toDataURL("image/png"); // 获取当前时间并格式化为 YYYYMMDDHHMMSS var now = new Date(); var timestamp = now.getFullYear().toString() + (now.getMonth() + 1).toString().padStart(2, '0') + now.getDate().toString().padStart(2, '0') + now.getHours().toString().padStart(2, '0') + now.getMinutes().toString().padStart(2, '0') + now.getSeconds().toString().padStart(2, '0'); var downloadLink = document.createElement("a"); downloadLink.href = dataURL; downloadLink.download = timestamp + "-截图.png"; downloadLink.click(); // console.log("click - 2"); } else { // console.log("click - 3"); alert("未找到视频元素!"); } } // bilbil function buildScreenshotButtonToBilbil() { var controlBar = document.querySelector('.bpx-player-control-bottom-right'); if (controlBar) { var screenshotButton = document.createElement("div"); screenshotButton.className = "bpx-player-ctrl-btn"; screenshotButton.style.marginRight = "15px"; screenshotButton.role = "button"; screenshotButton.ariaLabel = "截图"; screenshotButton.tabIndex = 0; screenshotButton.innerHTML = '<div class="bpx-player-ctrl-quality-result">截图</div>'; controlBar.insertBefore(screenshotButton, controlBar.querySelector('.bpx-player-ctrl-playbackrate')); screenshotButton.addEventListener("click", function () { DoScreenshot() }); return true } else { return false } } // 创建截图按钮 function buildScreenshotButtonToCommon() { var screenshotButton = document.createElement('div'); screenshotButton.className = 'screenshot-button'; screenshotButton.style.position = 'fixed'; screenshotButton.style.top = '200px'; screenshotButton.style.left = '10px'; screenshotButton.style.width = '40px'; screenshotButton.style.height = '40px'; screenshotButton.style.zIndex = 1000000; screenshotButton.style.backgroundColor = '#000'; screenshotButton.style.color = '#fff'; screenshotButton.style.display = 'flex'; screenshotButton.style.alignItems = 'center'; screenshotButton.style.justifyContent = 'center'; screenshotButton.style.borderRadius = '10px'; screenshotButton.style.cursor = 'pointer'; screenshotButton.style.userSelect = 'none'; screenshotButton.style.backgroundImage = 'url(https://chuizi.shop/files/video-screenshot-do.png)'; // 替换为实际的图片路径 screenshotButton.style.backgroundSize = 'cover'; screenshotButton.style.backgroundPosition = 'center'; screenshotButton.style.backgroundRepeat = 'no-repeat'; document.body.appendChild(screenshotButton); screenshotButton.addEventListener('click', function () { DoScreenshot(); }); makeDraggable(screenshotButton); } function makeDraggable(element) { element.addEventListener('mousedown', function (e) { isDragging = true; offsetX = e.clientX - element.getBoundingClientRect().left; offsetY = e.clientY - element.getBoundingClientRect().top; }); window.addEventListener('mousemove', function (e) { if (isDragging) { if ((e.clientY - offsetY) <= 10) { element.style.top = '10px'; } else if ((e.clientY - offsetY + 10) > (window.innerHeight - parseFloat(element.style.height))) { element.style.top = (window.innerHeight - element.style.height - 10) + 'px'; } else { // element.style.left = (e.clientX - offsetX) + 'px'; element.style.top = (e.clientY - offsetY) + 'px'; } canScreenshot = false; } }); window.addEventListener('mouseup', function () { isDragging = false; setTimeout(() => { canScreenshot = true; }, 100); }); } window.addEventListener('load', function () { buildScreenshotButtonToBilbil(); buildScreenshotButtonToCommon(); }); })();