您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
6/1/2024, 9:49:46 PM
// ==UserScript== // @name RTP subs Downloader // @namespace Violentmonkey Scripts // @match https://www.rtp.pt/play* // @grant none // @version 1.0 // @author - // @description 6/1/2024, 9:49:46 PM // @license MIT // ==/UserScript== (function () { 'use strict'; // Get the website's source code const sourceCode = document.documentElement.outerHTML; const urlPattern = /cdn-ondemand\.rtp\.pt\/nas2\.share\/legendas[\/\w]+/; const match = sourceCode.match(urlPattern); if (match) { var div = document.getElementsByClassName('text-muted vod-data')[0]; var a = document.createElement('a'); a.setAttribute('href','https://' + match[0] + '.vtt'); a.setAttribute('download','sub'); a.appendChild(document.createTextNode('DL PT')); div.appendChild(a); var a_en = document.createElement('a'); a_en.setAttribute('href','https://' + match[0] + '_en.vtt'); a_en.setAttribute('download','sub_en.vtt'); a_en.appendChild(document.createTextNode(' DL EN')); div.appendChild(a_en); } else { console.log('URL not found in the website\'s content.'); } })();