一键从多个视频平台轻松下载字幕
当前为
// ==UserScript==
// @name SubtitleEase: One-Click Video Subtitle Downloader
// @name:zh-CN 字幕助手: 一键视频字幕下载器
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Easily download subtitles from various video platforms with one click
// @description:zh-CN 一键从多个视频平台轻松下载字幕
// @author Your Name
// @license MIT
// @match *://*.youtube.com/*
// @match *://*.viki.com/*
// @match *://*.viu.com/*
// @match *://*.kocowa.com/*
// @match *://*.wetv.vip/*
// @match *://*.bilibili.com/*
// @match *://*.facebook.com/*
// @match *://*.ted.com/*
// @match *://*.altbalaji.com/*
// @match *://*.brightcove.com/*
// @match *://*.dailymotion.com/*
// @match *://*.dimsum.my/*
// @match *://*.ondemandchina.com/*
// @match *://*.erosnow.com/*
// @match *://*.drive.google.com/*
// @match *://*.hotstar.com/*
// @match *://*.iq.com/*
// @match *://*.iflix.com/*
// @match *://*.metopera.org/*
// @match *://*.mgtv.com/*
// @match *://*.ondemandkorea.com/*
// @match *://*.tv.naver.com/*
// @match *://*.tv.nrk.no/*
// @match *://*.line.me/*
// @match *://*.tubitv.com/*
// @match *://*.vk.com/*
// @match *://*.vlive.tv/*
// @match *://*.vimeo.com/*
// @match *://*.voot.com/*
// @match *://*.weverse.io/*
// @match *://*.zee5.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=downsub.com
// @grant GM_registerMenuCommand
// @grant GM_openInTab
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
const DOWNSUB_URL = 'https://downsub.com/';
// 添加样式
GM_addStyle(`
.subtitle-ease-btn {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
z-index: 9999;
}
.subtitle-ease-btn:hover {
background-color: #45a049;
}
`);
// 创建下载按钮
function createDownloadButton() {
const button = document.createElement('button');
button.textContent = '下载字幕';
button.className = 'subtitle-ease-btn';
button.addEventListener('click', openDownSubTab);
document.body.appendChild(button);
}
// 打开 DownSub 标签页
function openDownSubTab() {
const currentURL = encodeURIComponent(window.location.href);
const downsubURL = `${DOWNSUB_URL}?url=${currentURL}`;
GM_openInTab(downsubURL, { active: true });
}
// 注册菜单命令
GM_registerMenuCommand("下载字幕", openDownSubTab);
// 创建下载按钮
createDownloadButton();
// 监听 URL 变化(用于单页应用)
let lastUrl = location.href;
new MutationObserver(() => {
const url = location.href;
if (url !== lastUrl) {
lastUrl = url;
// 重新创建按钮,确保在页面切换后仍然存在
const existingButton = document.querySelector('.subtitle-ease-btn');
if (existingButton) {
existingButton.remove();
}
createDownloadButton();
}
}).observe(document, { subtree: true, childList: true });
})();